Skip to content

Commit b2a3200

Browse files
committed
Moved all "test" projects into a separate folder to clarify what is part of the runtime versus what isn't - these projects have also been renamed to clarify what they are for.
Added "stub" code for several Windows.Forms related functionality so that the original code can be kept more intact - can possibly utilize these to create cross-platform implementations? Code cleanup. Worked on getting as many tests working as possible - now down to 5 that aren't working. Three of these are presenting themselves as "real head scratchers" (LateIndexSet, 2 of the 8 Asc/Chr Double Byte).
1 parent 9d9e6c0 commit b2a3200

File tree

124 files changed

+2549
-1512
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+2549
-1512
lines changed

Community.VisualBasic.Tests/Community.VisualBasic.Tests.vbproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26-
<ProjectReference Include="..\Community.VisualBasic\Community.VisualBasic\Community.VisualBasic.vbproj" />
26+
<ProjectReference Include="..\Community.VisualBasic\Community.VisualBasic.vbproj" />
2727
</ItemGroup>
2828

2929
</Project>

Community.VisualBasic.Tests/Community/VisualBasic/FileIO/FileSystemTests.vb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ Namespace Global.Community.VisualBasic.FileIO.Tests
116116
Next
117117
End Sub
118118

119+
#If TARGET_WINDOWS Then
120+
119121
'<ConditionalFact(NameOf(ManualTestsEnabled))>
120122
'<PlatformSpecific(TestPlatforms.Windows)>
121123
<Fact>
@@ -135,6 +137,8 @@ Namespace Global.Community.VisualBasic.FileIO.Tests
135137
Next
136138
End Sub
137139

140+
#End If
141+
138142
'<PlatformSpecific(TestPlatforms.AnyUnix)>
139143
<Fact>
140144
Public Sub CopyDirectory_SourceDirectoryName_DestinationDirectoryName_UIOptionUnix()
@@ -204,6 +208,8 @@ Namespace Global.Community.VisualBasic.FileIO.Tests
204208

205209
End Sub
206210

211+
#If TARGET_WINDOWS Then
212+
207213
'<ConditionalFact(NameOf(ManualTestsEnabled))>
208214
'<PlatformSpecific(TestPlatforms.Windows)>
209215
<Fact>
@@ -241,6 +247,8 @@ Namespace Global.Community.VisualBasic.FileIO.Tests
241247

242248
End Sub
243249

250+
#End If
251+
244252
<Fact>
245253
Public Sub CreateDirectory_Directory()
246254
Dim FullPathToNewDirectory As String = IO.Path.Combine(TestDirectory, "NewDirectory")
@@ -326,6 +334,8 @@ Namespace Global.Community.VisualBasic.FileIO.Tests
326334

327335
End Sub
328336

337+
#If TARGET_WINDOWS Then
338+
329339
'<ConditionalFact(NameOf(ManualTestsEnabled))>
330340
'<PlatformSpecific(TestPlatforms.Windows)>
331341
<Fact>
@@ -360,6 +370,8 @@ Namespace Global.Community.VisualBasic.FileIO.Tests
360370

361371
End Sub
362372

373+
#End If
374+
363375
<Fact>
364376
Public Sub DeleteFile_File()
365377

@@ -581,6 +593,8 @@ Namespace Global.Community.VisualBasic.FileIO.Tests
581593
IO.File.Delete(TempFile)
582594
End Sub
583595

596+
#If TARGET_WINDOWS Then
597+
584598
'<ConditionalFact(NameOf(ManualTestsEnabled))>
585599
'<PlatformSpecific(TestPlatforms.Windows)>
586600
<Fact>
@@ -607,6 +621,8 @@ Namespace Global.Community.VisualBasic.FileIO.Tests
607621
Next
608622
End Sub
609623

624+
#End If
625+
610626
<Fact>
611627
Public Sub MoveDirectory_SourceDirectoryName_DestinationDirectoryName()
612628
Dim FullPathToSourceDirectory As String = IO.Path.Combine(TestDirectory, "SourceDirectory")
@@ -731,6 +747,8 @@ Namespace Global.Community.VisualBasic.FileIO.Tests
731747
Assert.[True](HasExpectedData(SourceFileNameWithPath, SourceData))
732748
End Sub
733749

750+
#If TARGET_WINDOWS Then
751+
734752
'<ConditionalFact(NameOf(ManualTestsEnabled))>
735753
'<PlatformSpecific(TestPlatforms.Windows)>
736754
<Fact>
@@ -749,6 +767,8 @@ Namespace Global.Community.VisualBasic.FileIO.Tests
749767
Assert.[True](IO.File.Exists(SourceFileNameWithPath))
750768
End Sub
751769

770+
#End If
771+
752772
' Not tested:
753773
' public Microsoft.VisualBasic.FileIO.TextFieldParser OpenTextFieldParser(string file) { throw null; }
754774
' public Microsoft.VisualBasic.FileIO.TextFieldParser OpenTextFieldParser(string file, params int[] fieldWidths) { throw null; }

Community.VisualBasic.Tests/NewLateBindingTests.vb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
Option Compare Text
55
Option Explicit On
6-
Option Infer Off
6+
Option Infer On
77
Option Strict On
88

99
Imports System.Collections.Generic
@@ -87,10 +87,11 @@ Namespace Global.Community.VisualBasic.CompilerServices.Tests
8787
End Class
8888

8989
Public Shared Iterator Function LateCall_OptionalValues_Data() As IEnumerable(Of Object())
90-
' TODO Check: Local function was replaced with Lambda
91-
Dim CreateData As Func(Of String, Object(), Type(), String, Object()) = Function(memberName As String, arguments As Object(), typeArguments As Type(), expectedValue As String) As Object()
92-
Return New Object() {memberName, arguments, typeArguments, expectedValue}
93-
End Function
90+
91+
Dim CreateData = Function(memberName As String, arguments As Object(), typeArguments As Type(), expectedValue As String) As Object()
92+
Return New Object() {memberName, arguments, typeArguments, expectedValue}
93+
End Function
94+
9495
' If System.Type.Missing is used for a parameter with type parameter type,
9596
' System.Reflection.Missing is used in type inference. This matches .NET Framework behavior.
9697

@@ -141,15 +142,14 @@ Namespace Global.Community.VisualBasic.CompilerServices.Tests
141142
' NewLateBinding.LateCall() corresponds to a call to the member when using late binding:
142143
' Dim instance = New OptionalValuesType()
143144
' instance.Member(arguments)
144-
Dim actualValue As Object = NewLateBinding.LateCall(
145-
Instance:=New OptionalValuesType,
146-
Type:=Nothing,
147-
MemberName:=memberName,
148-
Arguments:=arguments,
149-
ArgumentNames:=Nothing,
150-
TypeArguments:=typeArguments,
151-
CopyBack:=Nothing,
152-
IgnoreReturn:=True)
145+
Dim actualValue = NewLateBinding.LateCall(Instance:=New OptionalValuesType,
146+
Type:=Nothing,
147+
MemberName:=memberName,
148+
Arguments:=arguments,
149+
ArgumentNames:=Nothing,
150+
TypeArguments:=typeArguments,
151+
CopyBack:=Nothing,
152+
IgnoreReturn:=True)
153153
Assert.Equal(expectedValue, actualValue)
154154
End Sub
155155

Community.VisualBasic.Tests/TestUtilities/System/PlatformDetection.vb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ Namespace Global.Community
238238
End Get
239239
End Property
240240
#Else
241-
public static bool IsReflectionEmitSupported => true;
241+
Public ReadOnly Property IsReflectionEmitSupported As Boolean
242+
Get
243+
Return True
244+
End Get
245+
End Property
242246
#End If
243247

244248
Public ReadOnly Property IsInvokingStaticConstructorsSupported As Boolean
@@ -432,7 +436,7 @@ Namespace Global.Community
432436
If interopGlobalization IsNot Nothing Then
433437
Dim methodInfo1 As MethodInfo = interopGlobalization.GetMethod("GetICUVersion", BindingFlags.NonPublic Or BindingFlags.[Static])
434438
If methodInfo1 IsNot Nothing Then
435-
version1 = CInt(Fix(methodInfo1.Invoke(Nothing, Nothing)))
439+
version1 = CInt(Community.VisualBasic.Fix(methodInfo1.Invoke(Nothing, Nothing)))
436440
End If
437441
End If
438442
Catch
@@ -491,7 +495,7 @@ Namespace Global.Community
491495
Private Function OpenSslGetTlsSupport(protocol As SslProtocols) As Boolean
492496
Debug.Assert(IsOpenSslSupported)
493497

494-
Dim ret As Integer = Interop.OpenSsl.OpenSslGetProtocolSupport(CInt(Fix(protocol)))
498+
Dim ret As Integer = Interop.OpenSsl.OpenSslGetProtocolSupport(CInt(Community.VisualBasic.Fix(protocol)))
495499
Return ret = 1
496500
End Function
497501

Community.VisualBasic/Community.VisualBasic.sln renamed to Community.VisualBasic.sln

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,23 @@ VisualStudioVersion = 16.0.30711.63
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Community.VisualBasic", "Community.VisualBasic\Community.VisualBasic.vbproj", "{5C7333BA-E36F-4918-95F0-82BF3AE6F6E3}"
77
EndProject
8-
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "ConsoleTestApp", "..\ConsoleTestApp\ConsoleTestApp.vbproj", "{0D2B402A-8913-40F5-9361-0B2EC828338B}"
8+
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "net5-console", "ProjectTypeTests\net5-console\net5-console.vbproj", "{0D2B402A-8913-40F5-9361-0B2EC828338B}"
99
EndProject
10-
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "WinFormsTestApp", "..\WinFormsTestApp\WinFormsTestApp.vbproj", "{F331BCC6-7773-47D3-89FE-946341D39F73}"
10+
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "net5-windows", "ProjectTypeTests\net5-windows\net5-windows.vbproj", "{F331BCC6-7773-47D3-89FE-946341D39F73}"
1111
EndProject
12-
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "ClassLibraryTest", "..\ClassLibraryTest\ClassLibraryTest.vbproj", "{7DD0482C-2D6E-47B0-BA0C-28D5589D70C7}"
12+
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "netstandard2_0", "ProjectTypeTests\netstandard2_0\netstandard2_0.vbproj", "{7DD0482C-2D6E-47B0-BA0C-28D5589D70C7}"
1313
EndProject
14-
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ConsoleTestFramework", "ConsoleTestFramework\ConsoleTestFramework.vbproj", "{95EED873-FA2D-4A31-815A-15D74D6AEEA1}"
14+
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "net4-console", "ProjectTypeTests\net4-console\net4-console.vbproj", "{95EED873-FA2D-4A31-815A-15D74D6AEEA1}"
1515
EndProject
16-
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Community.VisualBasic.Tests", "..\Community.VisualBasic.Tests\Community.VisualBasic.Tests.vbproj", "{78554D4F-CE23-411F-9660-E016AE00C956}"
16+
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Community.VisualBasic.Tests", "Community.VisualBasic.Tests\Community.VisualBasic.Tests.vbproj", "{78554D4F-CE23-411F-9660-E016AE00C956}"
17+
EndProject
18+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ProjectTypeTests", "ProjectTypeTests", "{2D1C234B-3890-48B7-9338-980BCD043856}"
19+
EndProject
20+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{59F85EF7-136F-40E6-816D-BB14EAEC44DC}"
21+
ProjectSection(SolutionItems) = preProject
22+
LICENSE = LICENSE
23+
README.md = README.md
24+
EndProjectSection
1725
EndProject
1826
Global
1927
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -49,6 +57,12 @@ Global
4957
GlobalSection(SolutionProperties) = preSolution
5058
HideSolutionNode = FALSE
5159
EndGlobalSection
60+
GlobalSection(NestedProjects) = preSolution
61+
{0D2B402A-8913-40F5-9361-0B2EC828338B} = {2D1C234B-3890-48B7-9338-980BCD043856}
62+
{F331BCC6-7773-47D3-89FE-946341D39F73} = {2D1C234B-3890-48B7-9338-980BCD043856}
63+
{7DD0482C-2D6E-47B0-BA0C-28D5589D70C7} = {2D1C234B-3890-48B7-9338-980BCD043856}
64+
{95EED873-FA2D-4A31-815A-15D74D6AEEA1} = {2D1C234B-3890-48B7-9338-980BCD043856}
65+
EndGlobalSection
5266
GlobalSection(ExtensibilityGlobals) = postSolution
5367
SolutionGuid = {AB9112E2-7B45-4CF7-9583-08415020ED66}
5468
EndGlobalSection

0 commit comments

Comments
 (0)