diff --git a/DylibBinder/DylibBinder.csproj b/DylibBinder/DylibBinder.csproj
index 20a7cfcf..39b857ad 100644
--- a/DylibBinder/DylibBinder.csproj
+++ b/DylibBinder/DylibBinder.csproj
@@ -1,92 +1,22 @@
-
-
-
- Debug
- x86
- {2BB83AA6-D9DB-432F-8FC1-7AC83E7FE97B}
- Exe
- DylibBinder
- DylibBinder
- v4.8
-
-
- true
- full
- false
- bin\Debug
- DEBUG;
- prompt
- 4
- true
- x64
- latest
-
-
- true
- bin\Release
- prompt
- 4
- true
- x86
- latest
-
-
-
-
- ..\packages\Mono.Options.6.6.0.161\lib\net40\Mono.Options.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}
- Dynamo
-
-
- {65E8BE11-4D82-4EA5-9D14-3CA044D443EF}
- SwiftReflector
-
-
- {B7E6CF5A-B836-41CF-988C-A83607AF5445}
- SwiftRuntimeLibrary
-
-
- {8CAC7366-9650-440D-A3C5-36D880285DD5}
- tom-swifty
-
-
-
- latest
-
-
-
\ No newline at end of file
+
+
+ net7.0
+ x86
+ Exe
+ false
+ x86;AnyCPU
+ true
+
+
+
+
+
+
+
+
+
+
+
+ latest
+
+
diff --git a/DylibBinder/Properties/AssemblyInfo.cs b/DylibBinder/Properties/AssemblyInfo.cs
index ea008d27..3c601cb3 100644
--- a/DylibBinder/Properties/AssemblyInfo.cs
+++ b/DylibBinder/Properties/AssemblyInfo.cs
@@ -17,7 +17,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion ("1.0.*")]
+[assembly: AssemblyVersion ("1.0.0")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
diff --git a/DylibBinder/packages.config b/DylibBinder/packages.config
deleted file mode 100644
index f91cb54d..00000000
--- a/DylibBinder/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/Dynamo/Dynamo.CSLang/CSDelegateTypeDecl.cs b/Dynamo/Dynamo.CSLang/CSDelegateTypeDecl.cs
index de519169..7f678dd7 100644
--- a/Dynamo/Dynamo.CSLang/CSDelegateTypeDecl.cs
+++ b/Dynamo/Dynamo.CSLang/CSDelegateTypeDecl.cs
@@ -5,23 +5,27 @@
namespace Dynamo.CSLang {
public class CSDelegateTypeDecl : DelegatedSimpleElement, ICSStatement {
- public CSDelegateTypeDecl (CSVisibility vis, CSType type, CSIdentifier name, CSParameterList parms)
+ public CSDelegateTypeDecl (CSVisibility vis, CSType type, CSIdentifier name, CSParameterList parms, bool isUnsafe = false)
{
Visibility = vis;
Type = type != null ? type : CSSimpleType.Void;
Name = Exceptions.ThrowOnNull (name, "name");
Parameters = parms;
+ IsUnsafe = isUnsafe;
}
public CSVisibility Visibility { get; private set; }
public CSType Type { get; private set; }
public CSIdentifier Name { get; private set; }
public CSParameterList Parameters { get; private set; }
+ public bool IsUnsafe { get; private set; }
protected override void LLWrite (ICodeWriter writer, object o)
{
writer.BeginNewLine (true);
writer.Write (CSMethod.VisibilityToString (Visibility), false);
+ if (IsUnsafe)
+ writer.Write (" unsafe", true);
writer.Write (" delegate ", true);
Type.WriteAll (writer);
writer.Write (' ', true);
diff --git a/Dynamo/Dynamo.CSLang/CSFieldDeclaration.cs b/Dynamo/Dynamo.CSLang/CSFieldDeclaration.cs
index cf34b9e8..caf1dd0d 100644
--- a/Dynamo/Dynamo.CSLang/CSFieldDeclaration.cs
+++ b/Dynamo/Dynamo.CSLang/CSFieldDeclaration.cs
@@ -53,15 +53,20 @@ public static CSLine VarLine (CSIdentifier name, ICSExpression value)
}
public class CSFieldDeclaration : CSVariableDeclaration {
- public CSFieldDeclaration (CSType type, IEnumerable bindings, CSVisibility vis = CSVisibility.None, bool isStatic = false, bool isReadonly = false)
+ public CSFieldDeclaration (CSType type, IEnumerable bindings, CSVisibility vis = CSVisibility.None, bool isStatic = false, bool isReadonly = false, bool isUnsafe = false)
: base (type, bindings)
{
Visibilty = vis;
IsStatic = isStatic;
+ IsUnsafe = isUnsafe;
if (isReadonly) {
this.Insert (0, new SimpleElement ("readonly"));
this.Insert (1, SimpleElement.Spacer);
}
+ if (IsUnsafe) {
+ this.Insert (0, new SimpleElement ("unsafe"));
+ this.Insert (1, SimpleElement.Spacer);
+ }
if (isStatic) {
this.Insert (0, new SimpleElement ("static"));
this.Insert (1, SimpleElement.Spacer);
@@ -72,19 +77,20 @@ public CSFieldDeclaration (CSType type, IEnumerable bindings, CSVisib
}
}
- public CSFieldDeclaration (CSType type, string name, ICSExpression value = null, CSVisibility vis = CSVisibility.None, bool isSatic = false, bool isReadonly = false)
- : this (type, new CSIdentifier (name), value, vis, isSatic, isReadonly)
+ public CSFieldDeclaration (CSType type, string name, ICSExpression value = null, CSVisibility vis = CSVisibility.None, bool isStatic = false, bool isReadonly = false, bool isUnsafe = false)
+ : this (type, new CSIdentifier (name), value, vis, isStatic, isReadonly, isUnsafe)
{
}
- public CSFieldDeclaration (CSType type, CSIdentifier name, ICSExpression value = null, CSVisibility vis = CSVisibility.None, bool isStatic = false, bool isReadOnly = false)
- : this (type, new CSBinding [] { new CSBinding (name, value) }, vis, isStatic, isReadOnly)
+ public CSFieldDeclaration (CSType type, CSIdentifier name, ICSExpression value = null, CSVisibility vis = CSVisibility.None, bool isStatic = false, bool isReadOnly = false, bool isUnsafe = false)
+ : this (type, new CSBinding [] { new CSBinding (name, value) }, vis, isStatic, isReadOnly, isUnsafe)
{
}
public CSVisibility Visibilty { get; private set; }
public bool IsStatic { get; private set; }
+ public bool IsUnsafe { get; private set; }
public static CSLine FieldLine (CSType type, CSIdentifier name, ICSExpression value = null, CSVisibility vis = CSVisibility.None, bool isStatic = false)
{
diff --git a/Dynamo/Dynamo.CSLang/CSType.cs b/Dynamo/Dynamo.CSLang/CSType.cs
index 7b20d123..10b95b3f 100644
--- a/Dynamo/Dynamo.CSLang/CSType.cs
+++ b/Dynamo/Dynamo.CSLang/CSType.cs
@@ -87,6 +87,7 @@ public string Name {
public string GenericTypeName { get; private set; }
public CSType [] GenericTypes { get; private set; }
public bool IsArray { get; private set; }
+ public bool IsPointer { get; private set; }
string GenerateName ()
{
@@ -145,7 +146,7 @@ static CSSimpleType
tObject = new CSSimpleType ("object"),
tIntPtr = new CSSimpleType ("IntPtr"),
tVoid = new CSSimpleType ("void"),
- tByteStar = new CSSimpleType ("byte *"),
+ tByteStar = new CSSimpleType ("byte").Star,
tType = new CSSimpleType ("Type"),
tVar = new CSSimpleType ("var"),
tNfloat = new CSSimpleType ("nfloat"),
@@ -158,7 +159,9 @@ public CSSimpleType Star {
if (Name.EndsWith ("[]")) {
throw new NotImplementedException ("Blindly making an array a pointer doesn't do what you think.");
} else {
- return new CSSimpleType (Name + " *", false);
+ var ptrType = new CSSimpleType (Name + " *", false);
+ ptrType.IsPointer = true;
+ return ptrType;
}
}
}
diff --git a/Dynamo/Dynamo.CSLang/CSUnaryExpression.cs b/Dynamo/Dynamo.CSLang/CSUnaryExpression.cs
index 8f0faf65..cd6f34c8 100644
--- a/Dynamo/Dynamo.CSLang/CSUnaryExpression.cs
+++ b/Dynamo/Dynamo.CSLang/CSUnaryExpression.cs
@@ -47,6 +47,16 @@ static string OperatorToString (CSUnaryOperator op)
}
}
+ public static CSUnaryExpression AddressOf (ICSExpression expr)
+ {
+ return new CSUnaryExpression (CSUnaryOperator.AddressOf, expr);
+ }
+
+ public static CSUnaryExpression Star (ICSExpression expr)
+ {
+ return new CSUnaryExpression (CSUnaryOperator.Indirection, expr);
+ }
+
public static CSUnaryExpression Out (CSIdentifier id)
{
return new CSUnaryExpression (CSUnaryOperator.Out, id);
diff --git a/Dynamo/Dynamo.csproj b/Dynamo/Dynamo.csproj
index 8b78cee3..61131d8d 100644
--- a/Dynamo/Dynamo.csproj
+++ b/Dynamo/Dynamo.csproj
@@ -1,157 +1,11 @@
-
-
-
- Debug
- AnyCPU
- {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}
- Library
- Dynamo
- Dynamo
- v4.5
-
-
- true
- full
- false
- bin\Debug
- DEBUG;
- prompt
- 4
- false
-
-
- full
- true
- bin\Release
- prompt
- 4
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+ net7.0
+ Library
+ false
+ false
+
+
+
+
+
diff --git a/Dynamo/Dynamo.sln b/Dynamo/Dynamo.sln
index e703ee95..16e49df8 100644
--- a/Dynamo/Dynamo.sln
+++ b/Dynamo/Dynamo.sln
@@ -1,17 +1,17 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dynamo", "Dynamo.csproj", "{D0E2964B-34C9-4FEE-A638-A10E2E4A0917}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dynamo", "Dynamo.csproj", "{D0E2964B-34C9-4FEE-A638-A10E2E4A0917}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/Dynamo/Properties/AssemblyInfo.cs b/Dynamo/Properties/AssemblyInfo.cs
index 3136c105..3a13628b 100644
--- a/Dynamo/Properties/AssemblyInfo.cs
+++ b/Dynamo/Properties/AssemblyInfo.cs
@@ -20,7 +20,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion ("1.0.*")]
+[assembly: AssemblyVersion ("1.0.0")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
diff --git a/Make.config b/Make.config
index 7ef63325..50c0dd2a 100644
--- a/Make.config
+++ b/Make.config
@@ -42,14 +42,14 @@ MAX_MONO_VERSION=6.12.0.188
MIN_MONO_URL=https://download.mono-project.com/archive/6.12.0/macos-10-universal/MonoFramework-MDK-6.12.0.90.macos10.xamarin.universal.pkg
# XI version we need
-MIN_XI_VERSION=13.18.2.1
-MAX_XI_VERSION=13.18.2.1
-MIN_XI_URL=https://download.visualstudio.microsoft.com/download/pr/68ffa29a-6a5b-41f7-af7b-506ddcf4bbfc/35159cac3be1910e87309c0094a8ec8a/xamarin.ios-13.18.2.1.pkg
+MIN_XI_VERSION=16.4.0.23
+MAX_XI_VERSION=16.4.0.23
+MIN_XI_URL=https://download.visualstudio.microsoft.com/download/pr/6dea2e56-3063-42bf-9c65-4da93a8902c5/9e47ce909f4adbafaf7978cb6a39e3b5/xamarin.ios-16.4.0.23.pkg
# XM version we need
-MIN_XM_VERSION=6.22.1.26
-MAX_XM_VERSION=6.22.1.26
-MIN_XM_URL=https://download.visualstudio.microsoft.com/download/pr/68caeaf6-39d4-4b9b-85e3-d20c0a123d1e/3fd74515e676be1f528bd4bec104ca6c/xamarin.mac-6.22.1.26.pkg
+MIN_XM_VERSION=9.3.0.23
+MAX_XM_VERSION=9.3.0.23
+MIN_XM_URL=https://download.visualstudio.microsoft.com/download/pr/6dea2e56-3063-42bf-9c65-4da93a8902c5/414da4fd5cb1fac5e167f15927c28943/xamarin.mac-9.3.0.23.pkg
# Minimum macOS version for building
MIN_MACOS_BUILD_VERSION=10.15
diff --git a/SwiftReflector/CompilationSettings.cs b/SwiftReflector/CompilationSettings.cs
index c6cd1faf..83ff4b62 100644
--- a/SwiftReflector/CompilationSettings.cs
+++ b/SwiftReflector/CompilationSettings.cs
@@ -260,7 +260,7 @@ string SearchForScript ()
// from code main code base as run from the IDE:
// ../../tools/make-framework
// from unit tests:
- // ../../../../tools/make-framwork
+ // ../../../../../tools/make-framwork
// from Pack-Man installation:
// ../make-framework/make-framework
@@ -279,6 +279,10 @@ string SearchForScript ()
return backupIDEPath;
var greatGreatGrandParent = Directory.GetParent (greatGrandParent).ToString ();
var unitTestsPath = Path.Combine (greatGreatGrandParent, "tools/make-framework");
+ if (File.Exists (unitTestsPath))
+ return unitTestsPath;
+ var greatGreatGreatGrandParent = Directory.GetParent (greatGreatGrandParent).ToString ();
+ unitTestsPath = Path.Combine (greatGreatGreatGrandParent, "tools/make-framework");
return File.Exists (unitTestsPath) ? unitTestsPath : null;
}
diff --git a/SwiftReflector/IOUtils/OffsetStream.cs b/SwiftReflector/IOUtils/OffsetStream.cs
index e10e102a..f7479e4c 100644
--- a/SwiftReflector/IOUtils/OffsetStream.cs
+++ b/SwiftReflector/IOUtils/OffsetStream.cs
@@ -60,11 +60,6 @@ public override System.Threading.Tasks.Task CopyToAsync (Stream destination, int
return stm.CopyToAsync (destination, bufferSize, cancellationToken);
}
- public override System.Runtime.Remoting.ObjRef CreateObjRef (Type requestedType)
- {
- return stm.CreateObjRef (requestedType);
- }
-
protected override void Dispose (bool disposing)
{
if (disposing)
diff --git a/SwiftReflector/Importing/TypeAggregator.MacOS.cs b/SwiftReflector/Importing/TypeAggregator.MacOS.cs
index d256670f..00d55219 100644
--- a/SwiftReflector/Importing/TypeAggregator.MacOS.cs
+++ b/SwiftReflector/Importing/TypeAggregator.MacOS.cs
@@ -209,6 +209,8 @@ static partial void TypesToSkipMacOS (ref HashSet result)
"AppKit.NSTextStorageEditedFlags", // can't find it
"AppKit.NSType", // can't find it
"AppKit.NSUnderlinePattern", // not an enum
+ "AppKit.NSUnderlineStyle", // not part of AppKit
+ "AppKit.NSWritingDirection", // not part of AppKit
// AudioToolbox
"AudioToolbox.AudioQueueChannelAssignment", // macOS 10.15+
"AudioToolbox.AudioSessionInterruptionType", // iOS only
@@ -249,6 +251,8 @@ static partial void TypesToSkipMacOS (ref HashSet result)
"AVFoundation.AVSpeechBoundary", // macOS 10.14+
// AVKit
"AVKit.AVKitError", // not on macOS
+ // CoreBluetooth
+ "CoreBluetooth.CBPeripheralManagerAuthorizationStatus", // not showing in CoreBluetooth
// CoreFoundation
"CoreFoundation.DispatchBlockFlags",
"CoreFoundation.DispatchQualityOfService",
@@ -257,6 +261,8 @@ static partial void TypesToSkipMacOS (ref HashSet result)
// CoreGraphics
"CoreGraphics.CGPdfTagType",
"CoreGraphics.CGConstantColor",
+ // CoreLocation
+ "CoreLocation.CLLocationPushServiceError", // not found
// CoreMedia
"CoreMedia.CMSampleBufferAttachmentKey",
// CoreServices
@@ -347,6 +353,8 @@ static partial void TypesToSkipMacOS (ref HashSet result)
"MetalPerformanceShaders.MPSCnnLossType",
"MetalPerformanceShaders.MPSCnnReductionType",
"MetalPerformanceShaders.MPSCnnWeightsQuantizationType",
+ // ModelIO
+ "ModelIO.MDLVoxelIndexExtent2",
// Network
"NetworkExtension.NEDnsProtocol",
"NetworkExtension.NEDnsSettingsManagerError",
@@ -362,8 +370,10 @@ static partial void TypesToSkipMacOS (ref HashSet result)
"Photos.PHPhotosError",
// SafariServices
"SafariServices.SFErrorCode", // not on macOS
+ "SafariServices.SFSafariServicesVersion", // can't find it
// Security
"Security.AuthorizationStatus", // can't find it
+ "Security.SslCipherSuite", // can't find it
"Security.TlsCipherSuite",
"Security.TlsCipherSuiteGroup",
"Security.TlsProtocolVersion",
diff --git a/SwiftReflector/Importing/TypeAggregator.cs b/SwiftReflector/Importing/TypeAggregator.cs
index f8239b22..3f72d6b6 100644
--- a/SwiftReflector/Importing/TypeAggregator.cs
+++ b/SwiftReflector/Importing/TypeAggregator.cs
@@ -399,20 +399,32 @@ static HashSet ModuleSkipForPlatform (PlatformName platform)
static partial void TypesToSkipIOS (ref HashSet result);
static partial void TypesToSkipMacOS (ref HashSet result);
+ static HashSet typesToSkipIOS = null;
+ static HashSet typesToSkipMacOS = null;
+ static object skipLock = new object ();
+
static HashSet TypeSkipForPlatform (PlatformName platform)
{
- var result = new HashSet ();
- switch (platform) {
- case PlatformName.iOS:
- TypesToSkipIOS (ref result);
- break;
- case PlatformName.macOS:
- TypesToSkipMacOS (ref result);
- break;
- default:
- break;
+ lock (skipLock) {
+ var result = new HashSet ();
+ switch (platform) {
+ case PlatformName.iOS:
+ if (typesToSkipIOS is null) {
+ typesToSkipIOS = new HashSet ();
+ TypesToSkipIOS (ref typesToSkipIOS);
+ }
+ return typesToSkipIOS;
+ case PlatformName.macOS:
+ if (typesToSkipMacOS is null) {
+ typesToSkipMacOS = new HashSet ();
+ TypesToSkipMacOS (ref typesToSkipMacOS);
+ }
+ return typesToSkipMacOS;
+ default:
+ break;
+ }
+ return result;
}
- return result;
}
static partial void TypeNamesToMapIOS (ref Dictionary result);
diff --git a/SwiftReflector/Importing/TypeAggregator.iOS.cs b/SwiftReflector/Importing/TypeAggregator.iOS.cs
index 7ef54bbb..27e02e02 100644
--- a/SwiftReflector/Importing/TypeAggregator.iOS.cs
+++ b/SwiftReflector/Importing/TypeAggregator.iOS.cs
@@ -11,6 +11,7 @@ public partial class TypeAggregator {
static HashSet iOSModulesToSkip = new HashSet () {
"OpenTK", // not a namespace
"CoreMidi", // not a namespace
+ "iAd",
"Registrar", // not a namespace
"Twitter", // not compatible with Swift
"CoreAnimation", // not a namespace
@@ -176,6 +177,7 @@ static partial void AvailableMapIOS (ref Dictionary result)
"Contacts.CNSocialProfileServiceOption", // not an enum
// CoreBlueTooth
"CoreBluetooth.CBCentralManagerState",
+ "CoreBluetooth.CBPeripheralManagerAuthorizationStatus", // can't find it
"CoreBluetooth.CBPeripheralManagerState",
// CoreData
"CoreData.NSPersistentStoreUbiquitousTransitionType",
@@ -223,9 +225,13 @@ static partial void AvailableMapIOS (ref Dictionary result)
"CoreMedia.CMSampleBufferError", // doesn't exist
"CoreMedia.CMSyncError", // doesn't exist
// CoreNFC
+ "CoreNFC.EncryptionId", // not found
"CoreNFC.NFCIso15693ResponseFlag",
"CoreNFC.NFCNdefStatus", // iOS 13
"CoreNFC.NFCTagType", // iOS 13
+ "CoreNFC.PollingRequestCode", // not found
+ "CoreNFC.PollingTimeSlot", // not found
+ "CoreNFC.RequestFlag", // not found
"CoreNFC.VasErrorCode", // iOS 13
"CoreNFC.VasMode", // iOS 13
// CoreSpotlight
@@ -354,6 +360,7 @@ static partial void AvailableMapIOS (ref Dictionary result)
// ModelIO
"ModelIO.MDLNoiseTextureType", // can't find it
"ModelIO.MDLVoxelIndexExtent", // replaced
+ "ModelIO.MDLVoxelIndexExtent2", // can't find it
// Network
"Network.NWBrowseResultChange",
"Network.NWBrowserState",
@@ -400,6 +407,7 @@ static partial void AvailableMapIOS (ref Dictionary result)
"Security.SecRevocation", // not an enum
"Security.SecStatusCode", // can't find it
"Security.SecTokenID", // not an enum
+ "Security.SslCipherSuite", // can't find it
"Security.SslSessionConfig", // can't find it
"Security.SslSessionStrengthPolicy", // can't find it
"Security.SslStatus", // can't find it
@@ -445,6 +453,7 @@ static partial void AvailableMapIOS (ref Dictionary result)
"UIKit.UIPrintErrorCode", // can't find it?
"UIKit.UIPrintError", // can't find it?
"UIKit.UISceneErrorCode",
+ "UIKit.UITextWritingDirection", // can't find it
"UIKit.UITransitionViewControllerKind", // can't find it?
"UIKit.UIUserInterfaceStyle", // can't find it?
"UIKit.UIUserNotificationActionContext", // deprecated
diff --git a/SwiftReflector/MarshalEngine.cs b/SwiftReflector/MarshalEngine.cs
index b3702f58..4a4ee83d 100644
--- a/SwiftReflector/MarshalEngine.cs
+++ b/SwiftReflector/MarshalEngine.cs
@@ -797,15 +797,17 @@ CSBaseExpression MarshalClosure (CSParameter p, ClosureTypeSpec closure, Closure
string actionCallName = csSimp.GenericTypes.Count () == 0 ?
"SwiftClosureRepresentation.ActionCallbackVoidVoid" :
"SwiftClosureRepresentation.ActionCallback";
+ this.RequiredUnsafeCode = true; // for AddressOf
return new CSFunctionCall ("SwiftObjectRegistry.Registry.SwiftClosureForDelegate",
- false, p.Name, new CSIdentifier (actionCallName), typeArr);
+ false, p.Name, CSUnaryExpression.AddressOf (new CSIdentifier (actionCallName)), typeArr);
} else { // func
var typeArr = new CSArray1DInitialized ("Type",
csSimp.GenericTypes.Take (csSimp.GenericTypes.Length - 1).Select (ct => ct.Typeof ()));
string funcCallName = CallbackNameForFuncClosure (csSimp.GenericTypes.Count (), originalClosure);
var retType = TypeOfFuncClosureReturnType (csSimp.GenericTypes.Last (), originalClosure);
+ this.RequiredUnsafeCode = true; // for AddressOf
return new CSFunctionCall ("SwiftObjectRegistry.Registry.SwiftClosureForDelegate",
- false, p.Name, new CSIdentifier (funcCallName), typeArr, retType);
+ false, p.Name, CSUnaryExpression.AddressOf (new CSIdentifier (funcCallName)), typeArr, retType);
}
}
diff --git a/SwiftReflector/MarshalEngineCSafeSwiftToCSharp.cs b/SwiftReflector/MarshalEngineCSafeSwiftToCSharp.cs
index e63e3b4b..b621e056 100644
--- a/SwiftReflector/MarshalEngineCSafeSwiftToCSharp.cs
+++ b/SwiftReflector/MarshalEngineCSafeSwiftToCSharp.cs
@@ -166,7 +166,7 @@ public List MarshalFromLambdaReceiverToCSFunc (CSType thisType, st
if (csParmProxyType == null)
throw ErrorHelper.CreateError (ReflectorError.kTypeMapBase + 33, $"Unable to find C# interface type for protocol {entity.Type.ToFullyQualifiedName ()}");
- var retrievecall = new CSFunctionCall ($"SwiftObjectRegistry.Registry.InterfaceForExistentialContainer<{csParmType.ToString ()}>", false, delegateParams [i].Name);
+ var retrievecall = new CSFunctionCall ($"SwiftObjectRegistry.Registry.InterfaceForExistentialContainer<{csParmType.ToString ()}>", false, CSUnaryExpression.Star (delegateParams [i].Name));
if (csParm.ParameterKind == CSParameterKind.Out || csParm.ParameterKind == CSParameterKind.Ref) {
CSIdentifier id = new CSIdentifier (MarshalEngine.Uniqueify (delegateParams [i].Name.Name, identifiersUsed));
identifiersUsed.Add (id.Name);
@@ -277,7 +277,7 @@ public List MarshalFromLambdaReceiverToCSFunc (CSType thisType, st
string registryCall;
if (thisIsInterface && !hasAssociatedTypes) {
- registryCall = $"SwiftObjectRegistry.Registry.InterfaceForExistentialContainer<{thisTypeName}> (self)";
+ registryCall = $"SwiftObjectRegistry.Registry.InterfaceForExistentialContainer<{thisTypeName}> (*self)";
} else {
registryCall = isObjC ? $"Runtime.GetNSObject<{thisTypeName}> (self)" : $"SwiftObjectRegistry.Registry.CSObjectForSwiftObject <{thisTypeName}> (self)";
}
@@ -466,7 +466,7 @@ public List MarshalFromLambdaReceiverToCSProp (CSProperty prop, CS
CSIdentifier csharpCall = null;
var thisTypeName = hasAssociatedTypes ? csProxyName : thisType.ToString ();
if (forProtocol && !hasAssociatedTypes) {
- csharpCall = new CSInject ($"SwiftObjectRegistry.Registry.InterfaceForExistentialContainer<{thisTypeName}> (self).{prop.Name.Name}");
+ csharpCall = new CSInject ($"SwiftObjectRegistry.Registry.InterfaceForExistentialContainer<{thisTypeName}> (*self).{prop.Name.Name}");
} else {
var call = isObjC ?
$"ObjCRuntime.Runtime.GetNSObject<{thisTypeName}> (self).{prop.Name.Name}" :
@@ -537,7 +537,8 @@ public List MarshalFromLambdaReceiverToCSProp (CSProperty prop, CS
identifiersUsed.Add (returnContainerName);
var returnContainerId = new CSIdentifier (returnContainerName);
body.Add (CSVariableDeclaration.VarLine (CSSimpleType.Var, returnContainerId, new CSFunctionCall ("SwiftObjectRegistry.Registry.ExistentialContainerForProtocols", false, containerExprs.ToArray ())));
- body.Add (CSFunctionCall.FunctionCallLine ($"{returnContainerName}.CopyTo", false, new CSUnaryExpression (CSUnaryOperator.Ref, delegateParams [0].Name)));
+ body.Add (CSFunctionCall.FunctionCallLine ($"{returnContainerName}.CopyTo", false,
+ new CSFunctionCall ("IntPtr", true, delegateParams [0].Name)));
} else {
if (returnIsClosure) {
diff --git a/SwiftReflector/NewClassCompiler.cs b/SwiftReflector/NewClassCompiler.cs
index ddec08a6..b420cdc3 100644
--- a/SwiftReflector/NewClassCompiler.cs
+++ b/SwiftReflector/NewClassCompiler.cs
@@ -24,6 +24,7 @@
using SwiftReflector.Importing;
using ObjCRuntime;
using System.Threading.Tasks;
+using System.Runtime.InteropServices;
namespace SwiftReflector {
public class WrappingResult {
@@ -1622,7 +1623,7 @@ bool CompileProtocols (IEnumerable protocols, TempDirectory
nm.Block.Add (iface);
nm.Block.Add (cl);
nm.Block.Add (picl);
- if (vtable?.Delegates.Count > 0)
+ if (vtable?.Fields.Count > 0)
nm.Block.Add (vtable);
CSFile csfile = new CSFile (use, new CSNamespace [] { nm });
@@ -1847,7 +1848,6 @@ CSInterface CompileInterfaceAndProxy (ProtocolDeclaration protocolDecl, ModuleIn
proxyClass, picl, usedPinvokeNames, use, swiftLibraryPath,
out vtable);
-
if (!isExistential) {
var classContents = wrapper.Contents.Classes.Values.FirstOrDefault (cl => cl.Name.ToFullyQualifiedName () == wrapperClass.ToFullyQualifiedName ());
if (classContents == null)
@@ -2021,8 +2021,9 @@ bool ImplementProtocolDeclarationsVTableAndCSProxy (ModuleInventory modInventory
CollectAllProtocolMethods (virtFunctions, protocolDecl);
string vtableName = "xamVtable" + iface.Name;
string vtableTypeName = OverrideBuilder.VtableTypeName (protocolDecl);
+ var vtableType = new CSSimpleType (vtableTypeName);
if (virtFunctions.Count > 0)
- proxyClass.Fields.Add (CSFieldDeclaration.FieldLine (new CSSimpleType (vtableTypeName), vtableName, null, CSVisibility.None, true));
+ proxyClass.Fields.Add (CSFieldDeclaration.FieldLine (vtableType, vtableName, null, CSVisibility.None, true));
var vtableAssignments = new List ();
vtable = new CSStruct (CSVisibility.Internal, new CSIdentifier (vtableTypeName));
@@ -2052,8 +2053,9 @@ bool ImplementProtocolDeclarationsVTableAndCSProxy (ModuleInventory modInventory
virtFunctions, virtFunctions [i], vtableEntryIndex, vtableName, vtable, vtableAssignments, use, swiftLibraryPath);
}
}
- ImplementVTableInitializer (proxyClass, picl, usedPinvokeNames, protocolDecl, vtableAssignments, wrapper, vtableName, swiftLibraryPath);
- return vtable.Delegates.Count > 0;
+ ImplementVTableInitializer (proxyClass, picl, usedPinvokeNames, protocolDecl, vtableAssignments, wrapper, vtableType, vtableName, swiftLibraryPath);
+
+ return vtable.Fields.Count > 0;
}
void CollectAllProtocolMethods (List functions, ProtocolDeclaration decl)
@@ -2084,7 +2086,8 @@ int ImplementVtableMethodsSuperMethodsAndVtable (ModuleInventory modInventory, W
return 0;
string vtableName = "xamVtable" + cl.Name;
string vtableTypeName = OverrideBuilder.VtableTypeName (classDecl);
- cl.Fields.Add (CSFieldDeclaration.FieldLine (new CSSimpleType (vtableTypeName), vtableName, null, CSVisibility.None, true));
+ var vtableType = new CSSimpleType (vtableTypeName);
+ cl.Fields.Add (CSFieldDeclaration.FieldLine (vtableType, vtableName, null, CSVisibility.None, true));
var vtableAssignments = new List ();
@@ -2108,10 +2111,10 @@ int ImplementVtableMethodsSuperMethodsAndVtable (ModuleInventory modInventory, W
virtFuncs, virtFuncs [i], vtableEntryIndex, vtableName, vtable, vtableAssignments, use, swiftLibraryPath);
}
}
- if (vtable.Delegates.Count > 0) {
+ if (vtable.Fields.Count > 0) {
cl.InnerClasses.Add (vtable);
}
- ImplementVTableInitializer (cl, picl, usedPinvokeNames, classDecl, vtableAssignments, wrapper, vtableName, swiftLibraryPath);
+ ImplementVTableInitializer (cl, picl, usedPinvokeNames, classDecl, vtableAssignments, wrapper, vtableType, vtableName, swiftLibraryPath);
return virtFuncs.Count;
}
@@ -2128,8 +2131,9 @@ int ImplementMethodVtableForProtocolVirtualMethods (WrappingResult wrapper,
}
var delegateDecl = TLFCompiler.CompileToDelegateDeclaration (func, use, null, "Del" + OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex),
true, CSVisibility.Public, !protocolDecl.IsObjC && protocolDecl.IsExistential);
- vtable.Delegates.Add (delegateDecl);
- var field = new CSFieldDeclaration (new CSSimpleType (delegateDecl.Name.Name), OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex), null, CSVisibility.Public);
+ var unmanagedDelegateType = RecastDelegateDeclAsFunctionPtr (delegateDecl);
+
+ var field = new CSFieldDeclaration (unmanagedDelegateType, OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex), null, CSVisibility.Public, isUnsafe: true);
CSAttribute.MarshalAsFunctionPointer ().AttachBefore (field);
vtable.Fields.Add (new CSLine (field));
@@ -2163,7 +2167,7 @@ int ImplementMethodVtableForProtocolVirtualMethods (WrappingResult wrapper,
delegateDecl, use, func, publicMethod, vtable.Name, homonymSuffix, protocolDecl.IsObjC, !protocolDecl.IsExistential);
proxyClass.Methods.Add (staticRecv);
vtableAssignments.Add (CSAssignment.Assign (String.Format ("{0}.{1}", vtableName, OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex)),
- staticRecv.Name));
+ CSUnaryExpression.AddressOf (staticRecv.Name)));
return vtableEntryIndex + 1;
}
@@ -2177,8 +2181,9 @@ int ImplementMethodVtableForVirtualMethods (WrappingResult wrapper,
var subClassSwiftName = XmlToTLFunctionMapper.ToSwiftClassName (subclassDecl);
var delegateDecl = TLFCompiler.CompileToDelegateDeclaration (func, use, null, "Del" + OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex), true, CSVisibility.Public, false);
- vtable.Delegates.Add (delegateDecl);
- var field = new CSFieldDeclaration (new CSSimpleType (delegateDecl.Name.Name), OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex), null, CSVisibility.Public);
+ var unmanagedDelegate = RecastDelegateDeclAsFunctionPtr (delegateDecl);
+
+ var field = new CSFieldDeclaration (unmanagedDelegate, OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex), null, CSVisibility.Public, isUnsafe: true);
CSAttribute.MarshalAsFunctionPointer ().AttachBefore (field);
vtable.Fields.Add (new CSLine (field));
@@ -2219,7 +2224,7 @@ int ImplementMethodVtableForVirtualMethods (WrappingResult wrapper,
CSMethod staticRecv = ImplementVirtualMethodStaticReceiver (cl.ToCSType (), null, delegateDecl, use, func, publicOverload, vtable.Name, "", classDecl.IsObjCOrInheritsObjC (TypeMapper), false);
cl.Methods.Add (staticRecv);
vtableAssignments.Add (CSAssignment.Assign (String.Format ("{0}.{1}", vtableName, OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex)),
- staticRecv.Name));
+ CSUnaryExpression.AddressOf (staticRecv.Name)));
return vtableEntryIndex + 1;
}
@@ -2294,7 +2299,6 @@ CSProperty ImplementProtocolSubscriptEtter (WrappingResult wrapper,
{
CSDelegateTypeDecl etterDelegateDecl = DefineDelegateAndAddToVtable (vtable, etterFunc, use,
OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex), !protocolDecl.HasAssociatedTypes);
- vtable.Delegates.Add (etterDelegateDecl);
var etterWrapperFunc = FindProtocolWrapperFunction (etterFunc, wrapper);
if (etterWrapperFunc == null) {
@@ -2377,7 +2381,7 @@ CSProperty ImplementProtocolSubscriptEtter (WrappingResult wrapper,
proxyClass.Methods.Add (recv);
vtableAssignments.Add (CSAssignment.Assign (String.Format ("{0}.{1}",
- vtableName, OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex)), recv.Name));
+ vtableName, OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex)), CSUnaryExpression.AddressOf (recv.Name)));
return wrapperProp;
}
@@ -2419,7 +2423,6 @@ CSProperty ImplementSubscriptEtter (WrappingResult wrapper,
var etterDelegateDecl = DefineDelegateAndAddToVtable (vtable, etterFunc, use,
OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex), false);
- vtable.Delegates.Add (etterDelegateDecl);
TLFunction etterWrapper = null;
@@ -2508,7 +2511,7 @@ CSProperty ImplementSubscriptEtter (WrappingResult wrapper,
cl.Methods.Add (recv);
vtableAssignments.Add (CSAssignment.Assign (String.Format ("{0}.{1}",
- vtableName, OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex)), recv.Name));
+ vtableName, OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex)), CSUnaryExpression.AddressOf (recv.Name)));
return wrapperProp;
}
@@ -2581,7 +2584,6 @@ CSProperty ImplementProtocolPropertyEtter (WrappingResult wrapper,
{
var etterDelegateDecl = DefineDelegateAndAddToVtable (vtable, etterFunc, use,
OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex), protocolDecl.IsExistential);
- vtable.Delegates.Add (etterDelegateDecl);
var etterWrapperFunc = FindProtocolWrapperFunction (etterFunc, wrapper);
if (etterWrapperFunc == null) {
@@ -2658,7 +2660,7 @@ CSProperty ImplementProtocolPropertyEtter (WrappingResult wrapper,
proxyClass.Methods.Add (recvr);
vtableAssignments.Add (CSAssignment.Assign (String.Format ("{0}.{1}",
- vtableName, OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex)), recvr.Name));
+ vtableName, OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex)), CSUnaryExpression.AddressOf (recvr.Name)));
return wrapperProp;
}
@@ -2672,7 +2674,6 @@ CSProperty ImplementPropertyEtter (WrappingResult wrapper,
var swiftClassName = XmlToTLFunctionMapper.ToSwiftClassName (subclassDecl);
var etterDelegateDecl = DefineDelegateAndAddToVtable (vtable, etterFunc, use,
OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex), false);
- vtable.Delegates.Add (etterDelegateDecl);
var finder = new FunctionDeclarationWrapperFinder (TypeMapper, wrapper);
var etterWrapperFunc = finder.FindWrapperForMethod (classDecl ?? subclassDecl, etterFunc, isSetter ? PropertyType.Setter : PropertyType.Getter);
@@ -2761,7 +2762,7 @@ CSProperty ImplementPropertyEtter (WrappingResult wrapper,
cl.Methods.Add (recvr);
vtableAssignments.Add (CSAssignment.Assign (String.Format ("{0}.{1}",
- vtableName, OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex)), recvr.Name));
+ vtableName, OverrideBuilder.VTableEntryIdentifier (vtableEntryIndex)), CSUnaryExpression.AddressOf (recvr.Name)));
return wrapperProp;
}
@@ -2769,14 +2770,31 @@ CSDelegateTypeDecl DefineDelegateAndAddToVtable (CSStruct vtable, FunctionDeclar
{
var decl = TLFCompiler.CompileToDelegateDeclaration (func, use, null, "Del" + entryID,
true, CSVisibility.Public, isProtocol);
- var field = new CSFieldDeclaration (new CSSimpleType (decl.Name.Name), entryID, null, CSVisibility.Public);
+ var unmanagedFunctionPtrType = RecastDelegateDeclAsFunctionPtr (decl);
+
+ var field = new CSFieldDeclaration (unmanagedFunctionPtrType, new CSIdentifier (entryID), null, CSVisibility.Public, isStatic: false, isReadOnly: false, isUnsafe: true);
CSAttribute.MarshalAsFunctionPointer ().AttachBefore (field);
vtable.Fields.Add (new CSLine (field));
return decl;
}
+ CSSimpleType RecastDelegateDeclAsFunctionPtr (CSDelegateTypeDecl decl)
+ {
+ // given a type in the form:
+ // delegate returnType DelFunc(Arg1 arg1 ...)
+ // Turn it into
+ // delegate *unmanaged ();
+ var types = new CSType [decl.Parameters.Count + 1];
+ for (int i = 0; i < decl.Parameters.Count; i++) {
+ types [i] = decl.Parameters [i].CSType;
+ }
+ types [types.Length - 1] = decl.Type;
+ var declType = new CSSimpleType ("delegate *unmanaged", false, types);
+ return declType;
+ }
+
void ImplementVTableInitializer (CSClass cl, CSClass picl, List usedPinvokeNames, ClassDeclaration classDecl,
- List vtableAssignments, WrappingResult wrapper, string vtableName,
+ List vtableAssignments, WrappingResult wrapper, CSSimpleType vtableType, string vtableName,
string swiftLibraryPath)
{
if (vtableAssignments.Count == 0)
@@ -2806,32 +2824,26 @@ void ImplementVTableInitializer (CSClass cl, CSClass picl, List usedPinv
var setVTable = new CSMethod (CSVisibility.None, CSMethodKind.Static,
CSSimpleType.Void, new CSIdentifier ("XamSetVTable"), new CSParameterList (), new CSCodeBlock ());
- setVTable.Body.AddRange (vtableAssignments);
-
// unsafe {
- // vtData = stackalloc byte[Marshal.SizeOf(Monty_xam_vtable)];
- // vtPtr = new IntPtr(vtPtrData);
- // this repeats n time.
- // Marshal.WriteIntPtr(vtPtr + (IntPtr.Size * n), Marshal.GetFunctionPointerForDelegate(vtableName.funcn));
- // Pinvokes.SwiftXamSetVTable(vPtr [, StructMarshal.Marsahler.Metatypeof(gen0), StructMarshal.Marsahler.Metatypeof(gen0)...);
+ // fixed (VTableType *v = &vtableName) {
+ // SetVtable (new IntPtr (v));
+ // }
// }
var vtName = new CSIdentifier (vtableName);
var unsafeBlock = new CSUnsafeCodeBlock (null);
- var vtData = new CSIdentifier ("vtData");
- var vtableSize = new CSFunctionCall ("Marshal.SizeOf", false, vtName);
- var vtDataLine = CSVariableDeclaration.VarLine (CSSimpleType.ByteStar, vtData, CSArray1D.New (CSSimpleType.Byte, true, vtableSize));
- unsafeBlock.Add (vtDataLine);
+ unsafeBlock.AddRange (vtableAssignments);
+ var vtablePtrName = new CSIdentifier ("vtData");
+
+ var fixedBody = new List ();
+ var fixedBlock = new CSFixedCodeBlock (vtableType.Star, vtablePtrName, CSUnaryExpression.AddressOf (vtName), fixedBody);
+ unsafeBlock.Add (fixedBlock);
var vtPtr = new CSIdentifier ("vtPtr");
var varLine = CSVariableDeclaration.VarLine (
CSSimpleType.IntPtr, vtPtr,
- new CSFunctionCall ("IntPtr", true, vtData));
- unsafeBlock.Add (varLine);
-
- for (int i = 0; i < vtableAssignments.Count (); i++) {
- unsafeBlock.Add (CallToWriteIntPtr (vtPtr, i, vtableAssignments [i]));
- }
+ new CSFunctionCall ("IntPtr", true, vtablePtrName));
+ fixedBlock.Add (varLine);
var args = new List ();
args.Add (vtPtr);
@@ -2843,7 +2855,7 @@ void ImplementVTableInitializer (CSClass cl, CSClass picl, List usedPinv
}
}
- unsafeBlock.Add (CSFunctionCall.FunctionCallLine (String.Format ("{0}.{1}",
+ fixedBlock.Add (CSFunctionCall.FunctionCallLine (String.Format ("{0}.{1}",
picl.Name.Name, "SwiftXamSetVtable"), false, args.ToArray ()));
setVTable.Body.Add (unsafeBlock);
@@ -2851,17 +2863,6 @@ void ImplementVTableInitializer (CSClass cl, CSClass picl, List usedPinv
cl.Methods.Add (setVTable);
}
- static CSLine CallToWriteIntPtr (CSIdentifier vtPtrName, int index, CSLine assignLine)
- {
- var assign = assignLine.Contents as CSAssignment;
- if ((object)assign == null)
- throw new ArgumentException ($"Expecting an Assignment, but got {assignLine.Contents.GetType ()}", nameof (assignLine));
- var vtEl = assign.Target;
- var getDel = new CSFunctionCall ("Marshal.GetFunctionPointerForDelegate", false, vtEl);
- var ptrExp = index == 0 ? vtPtrName : vtPtrName + new CSParenthesisExpression (CSConstant.Val (index) * new CSIdentifier ("IntPtr.Size"));
- return CSFunctionCall.FunctionCallLine ("Marshal.WriteIntPtr", false, ptrExp, getDel);
- }
-
CSLine CallToSetVTable ()
{
return CSFunctionCall.FunctionCallLine (new CSIdentifier ("XamSetVTable"), false);
@@ -2893,15 +2894,16 @@ CSMethod ImplementVirtualSubscriptStaticReceiver (CSType thisType, string csProx
recvrName = "xamVtable_recv_" + (funcDecl.IsSubscriptGetter ? "index_get_" : "index_set_") + prop.Name.Name;
}
- recvr = new CSMethod (CSVisibility.None, CSMethodKind.Static, returnType,
+ var methodKind = CSMethodKind.Static;
+ if (delType.IsUnsafe || ParameterListContainsPointer (pl))
+ methodKind = CSMethodKind.StaticUnsafe;
+
+ recvr = new CSMethod (CSVisibility.None, methodKind, returnType,
new CSIdentifier (recvrName),
pl, body);
- use.AddIfNotPresent (typeof (Xamarin.iOS.MonoPInvokeCallbackAttribute), kMobilePlatforms);
- var args = new CSArgumentList ();
- args.Add (new CSFunctionCall ("typeof", false, new CSIdentifier (vtableName.Name + "." + delType.Name.Name)));
- var attr = CSAttribute.FromAttr (typeof (Xamarin.iOS.MonoPInvokeCallbackAttribute), args, true);
- CSConditionalCompilation.ProtectWithIfEndif (kMobilePlatforms, attr);
+ use.AddIfNotPresent (typeof (UnmanagedCallersOnlyAttribute));
+ var attr = CSAttribute.FromAttr (typeof (UnmanagedCallersOnlyAttribute), new CSArgumentList (), true);
attr.AttachBefore (recvr);
return recvr;
}
@@ -2934,13 +2936,14 @@ CSMethod ImplementVirtualPropertyStaticReceiver (CSType thisType, string csProxy
recvrName = "xamVtable_recv_" + (funcDecl.IsGetter ? "get_" : "set_") + prop.Name.Name;
}
- recvr = new CSMethod (CSVisibility.None, CSMethodKind.Static, returnType, new CSIdentifier (recvrName), pl, body);
+ var methodKind = CSMethodKind.Static;
+ if (delType.IsUnsafe || ParameterListContainsPointer (pl))
+ methodKind = CSMethodKind.StaticUnsafe;
- use.AddIfNotPresent ("ObjCRuntime", kMobilePlatforms);
- var args = new CSArgumentList ();
- args.Add (new CSFunctionCall ("typeof", false, new CSIdentifier (vtableName.Name + "." + delType.Name.Name)));
- var attr = CSAttribute.FromAttr (typeof (Xamarin.iOS.MonoPInvokeCallbackAttribute), args, true);
- CSConditionalCompilation.ProtectWithIfEndif (kMobilePlatforms, attr);
+ recvr = new CSMethod (CSVisibility.None, methodKind, returnType, new CSIdentifier (recvrName), pl, body);
+
+ use.AddIfNotPresent (typeof (UnmanagedCallersOnlyAttribute));
+ var attr = CSAttribute.FromAttr (typeof (UnmanagedCallersOnlyAttribute), new CSArgumentList (), true);
attr.AttachBefore (recvr);
return recvr;
}
@@ -2962,15 +2965,16 @@ CSMethod ImplementVirtualMethodStaticReceiver (CSType thisType, string csProxyNa
var body = new CSCodeBlock (bodyContents);
- var recvr = new CSMethod (CSVisibility.None, CSMethodKind.Static, delType.Type,
+ var methodKind = CSMethodKind.Static;
+ if (delType.IsUnsafe || ParameterListContainsPointer (pl))
+ methodKind = CSMethodKind.StaticUnsafe;
+
+ var recvr = new CSMethod (CSVisibility.None, methodKind, delType.Type,
new CSIdentifier ("xamVtable_recv_" + publicMethod.Name.Name + homonymSuffix),
pl, body);
- use.AddIfNotPresent ("ObjCRuntime", kMobilePlatforms);
- var args = new CSArgumentList ();
- args.Add (new CSFunctionCall ("typeof", false, new CSIdentifier (vtableName.Name + "." + delType.Name.Name)));
- var attr = CSAttribute.FromAttr (typeof (Xamarin.iOS.MonoPInvokeCallbackAttribute), args, true);
- CSConditionalCompilation.ProtectWithIfEndif (kMobilePlatforms, attr);
+ use.AddIfNotPresent (typeof (UnmanagedCallersOnlyAttribute));
+ var attr = CSAttribute.FromAttr (typeof (UnmanagedCallersOnlyAttribute), new CSArgumentList (), true);
attr.AttachBefore (recvr);
return recvr;
}
@@ -6058,5 +6062,11 @@ static bool IsOptional (TypeSpec spec)
{
return spec is NamedTypeSpec namedSpec && namedSpec.ContainsGenericParameters && namedSpec.Name == "Swift.Optional";
}
+
+ static bool ParameterListContainsPointer (CSParameterList pl)
+ {
+ return pl.FirstOrDefault (pi =>
+ pi.CSType is CSSimpleType cs && cs.IsPointer) is not null;
+ }
}
}
diff --git a/SwiftReflector/Properties/AssemblyInfo.cs b/SwiftReflector/Properties/AssemblyInfo.cs
index 20f13bd6..1bbacf23 100644
--- a/SwiftReflector/Properties/AssemblyInfo.cs
+++ b/SwiftReflector/Properties/AssemblyInfo.cs
@@ -20,7 +20,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion ("1.0.*")]
+[assembly: AssemblyVersion ("1.0.0")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
diff --git a/SwiftReflector/SwiftReflector.csproj b/SwiftReflector/SwiftReflector.csproj
index 99cd8b57..b1ebe238 100644
--- a/SwiftReflector/SwiftReflector.csproj
+++ b/SwiftReflector/SwiftReflector.csproj
@@ -1,230 +1,32 @@
-
-
+
- Debug
- AnyCPU
- {65E8BE11-4D82-4EA5-9D14-3CA044D443EF}
+ net7.0
Library
- SwiftReflector
- SwiftReflector
- v4.7.2
+ false
- true
- full
- false
- bin\Debug
DEBUG; SWIFT4;BINDING_TOOLS_FOR_SWIFT
- prompt
- 4
false
-
- true
- bin\Release
+
+
SWIFT4;BINDING_TOOLS_FOR_SWIFT
- prompt
- 4
false
-
-
-
-
-
- ..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.dll
-
-
- ..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.Mdb.dll
-
-
- ..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.Pdb.dll
-
-
- ..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.Rocks.dll
-
-
- ..\packages\Antlr4.Runtime.Standard.4.9.1\lib\netstandard2.0\Antlr4.Runtime.Standard.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {B7E6CF5A-B836-41CF-988C-A83607AF5445}
- SwiftRuntimeLibrary
-
-
- {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}
- Dynamo
-
+
+
-
-
-
+
+
diff --git a/SwiftReflector/SwiftTypeAttribute.cs b/SwiftReflector/SwiftTypeAttribute.cs
deleted file mode 100644
index cd9d6ee1..00000000
--- a/SwiftReflector/SwiftTypeAttribute.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using System;
-namespace SwiftReflector {
- public class SwiftTypeAttribute {
- public SwiftTypeAttribute (SwiftAttributeType attributeType)
- {
- AttributeType = AttributeType;
- }
-
- public string AttributeType { get; private set; }
- }
-}
diff --git a/SwiftReflector/TopLevelFunctionCompiler.cs b/SwiftReflector/TopLevelFunctionCompiler.cs
index 61d40477..a6e63c4b 100644
--- a/SwiftReflector/TopLevelFunctionCompiler.cs
+++ b/SwiftReflector/TopLevelFunctionCompiler.cs
@@ -148,6 +148,7 @@ public CSDelegateTypeDecl CompileToDelegateDeclaration (FunctionDeclaration func
RemapSwiftClosureRepresensation (args);
var returnType = returnIsGeneric || returnIsSelf ? null : typeMap.MapType (func, func.ReturnTypeSpec, objectsAreIntPtrs, true);
delegateName = delegateName ?? typeMap.SanitizeIdentifier (func.Name);
+ var isUnsafe = false;
args.ForEach (a => AddUsingBlock (packs, a.Type));
@@ -164,15 +165,18 @@ public CSDelegateTypeDecl CompileToDelegateDeclaration (FunctionDeclaration func
if (arg.Type.Entity == EntityType.Tuple || (!argIsGeneric && IsObjCStruct (parmType))) {
csParam = new CSParameter (CSSimpleType.IntPtr, new CSIdentifier (arg.Name), CSParameterKind.None, null);
} else {
- csParam = new CSParameter (arg.Type.ToCSType (packs), new CSIdentifier (arg.Name),
- arg.Type.IsReference ? CSParameterKind.Ref : CSParameterKind.None, null);
+ var argType = arg.Type.ToCSType (packs);
+ if (argType is CSSimpleType csType && arg.Type.IsReference)
+ argType = csType.Star;
+ csParam = new CSParameter (argType, new CSIdentifier (arg.Name), CSParameterKind.None, null);
}
csParams.Add (csParam);
}
if (isSwiftProtocol) {
packs.AddIfNotPresent (typeof (SwiftExistentialContainer1));
- csParams.Insert (0, new CSParameter (new CSSimpleType (typeof (SwiftExistentialContainer1)), new CSIdentifier ("self"), CSParameterKind.Ref));
+ csParams.Insert (0, new CSParameter (new CSSimpleType (typeof (SwiftExistentialContainer1)).Star, new CSIdentifier ("self"), CSParameterKind.None));
+ isUnsafe = true;
} else {
csParams.Insert (0, new CSParameter (CSSimpleType.IntPtr, new CSIdentifier ("self")));
}
@@ -195,7 +199,7 @@ public CSDelegateTypeDecl CompileToDelegateDeclaration (FunctionDeclaration func
csParams.Insert (0, new CSParameter (CSSimpleType.IntPtr, retvalID, CSParameterKind.None));
csReturnType = CSSimpleType.Void;
} else if (func.ReturnTypeSpec is ProtocolListTypeSpec pl) {
- csParams.Insert (0, new CSParameter (new CSSimpleType ($"SwiftExistentialContainer{pl.Protocols.Count}"), retvalID, CSParameterKind.Ref));
+ csParams.Insert (0, new CSParameter (new CSSimpleType ($"SwiftExistentialContainer{pl.Protocols.Count}").Star, retvalID, CSParameterKind.None));
csReturnType = CSSimpleType.Void;
}
}
@@ -205,7 +209,7 @@ public CSDelegateTypeDecl CompileToDelegateDeclaration (FunctionDeclaration func
}
}
- return new CSDelegateTypeDecl (vis, csReturnType, new CSIdentifier (delegateName), csParams);
+ return new CSDelegateTypeDecl (vis, csReturnType, new CSIdentifier (delegateName), csParams, isUnsafe);
}
public CSMethod CompileMethod (FunctionDeclaration func, CSUsingPackages packs, string libraryPath,
diff --git a/SwiftReflector/packages.config b/SwiftReflector/packages.config
deleted file mode 100644
index bd2763f1..00000000
--- a/SwiftReflector/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/SwiftRuntimeLibrary.Mac/Properties/AssemblyInfo.cs b/SwiftRuntimeLibrary.Mac/Properties/AssemblyInfo.cs
deleted file mode 100644
index 8295d18e..00000000
--- a/SwiftRuntimeLibrary.Mac/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes.
-// Change them to the values specific to your project.
-
-[assembly: AssemblyTitle("SwiftRuntimeLibrary.Mac")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("${AuthorCopyright}")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-
-[assembly: AssemblyVersion("1.0.*")]
-
-// The following attributes are used to specify the signing key for the assembly,
-// if desired. See the Mono documentation for more information about signing.
-
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]
diff --git a/SwiftRuntimeLibrary.Mac/SwiftMarshal/SwiftTypeNameAttribute.cs b/SwiftRuntimeLibrary.Mac/SwiftMarshal/SwiftTypeNameAttribute.cs
deleted file mode 100644
index 122b38df..00000000
--- a/SwiftRuntimeLibrary.Mac/SwiftMarshal/SwiftTypeNameAttribute.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using System.Reflection;
-
-namespace SwiftRuntimeLibrary.SwiftMarshal {
- [AttributeUsage (AttributeTargets.Enum | AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
- public class SwiftTypeNameAttribute : Attribute {
- public SwiftTypeNameAttribute (string swiftName)
- {
- SwiftName = Exceptions.ThrowOnNull (swiftName, nameof (swiftName));
- }
-
- public string SwiftName { get; private set; }
-
- static bool TryGetSwiftName (Type t, out string swiftName)
- {
- Exceptions.ThrowOnNull (t, nameof (t));
- var attr = t.GetCustomAttribute ();
- swiftName = attr != null ? attr.SwiftName : null;
- return swiftName != null;
- }
- }
-}
diff --git a/SwiftRuntimeLibrary.Mac/SwiftRuntimeLibrary.Mac.csproj b/SwiftRuntimeLibrary.Mac/SwiftRuntimeLibrary.Mac.csproj
index c04bfda8..f7c0261d 100644
--- a/SwiftRuntimeLibrary.Mac/SwiftRuntimeLibrary.Mac.csproj
+++ b/SwiftRuntimeLibrary.Mac/SwiftRuntimeLibrary.Mac.csproj
@@ -1,311 +1,263 @@
-
-
-
- Debug
- AnyCPU
- {12C9A447-D0EB-4FDD-8094-F8DE9945EFD0}
- {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- Library
- SwiftRuntimeLibrary.Mac
- SwiftRuntimeLibrary.Mac
- Resources
- true
-
-
- true
- full
- false
- bin\Debug
- __UNIFIED__;__MACOS__;DEBUG;SWIFT;SWIFT4
- prompt
- 4
- false
- false
- false
- false
- false
- HttpClientHandler
- None
-
- true
- None
-
-
- true
- bin\Release
- __UNIFIED__;__MACOS__;SWIFT;SWIFT4
- prompt
- 4
- false
- false
- false
- false
- false
- HttpClientHandler
- None
-
- true
- None
-
-
-
-
- SwiftAnyObject.cs
-
-
- Enums.cs
-
-
- ISwiftError.cs
-
-
- ISwiftHashable.cs
-
-
- ISwiftObject.cs
-
-
- MonoPInvokeCallbackAttribute.cs
-
-
- RuntimeDebugging.cs
-
-
- SwiftArray.cs
-
-
- SwiftClosureRepresentation.cs
-
-
- SwiftCore.cs
-
-
- SwiftDictionary.cs
-
-
- SwiftDotNetCapsule.cs
-
-
- SwiftEnumMapper.cs
-
-
- SwiftEnumRawValueAttribute.cs
-
-
- SwiftError.cs
-
-
- SwiftException.cs
-
-
- SwiftHashableProxy.cs
-
-
- SwiftMetatype.cs
-
-
- SwiftObjectRegistry.cs
-
-
- SwiftOptional.cs
-
-
- SwiftRuntimeException.cs
-
-
- SwiftString.cs
-
-
- XamProxyTypeAttribute.cs
-
-
- XamTrivialSwiftObject.cs
-
-
- SwiftMarshal\BlindClosureMapper.cs
-
-
- SwiftMarshal\DynamicLib.cs
-
-
- SwiftMarshal\Extensions.cs
-
-
- SwiftMarshal\Memory.cs
-
-
- SwiftMarshal\NominalSizeSet.cs
-
-
- SwiftMarshal\StructMarshal.cs
-
-
- SwiftMarshal\SwiftClassObject.cs
-
-
- SwiftMarshal\SwiftEnumBackingTypeAttribute.cs
-
-
- SwiftMarshal\SwiftEnumTypeAttribute.cs
-
-
- SwiftMarshal\SwiftExternalProtocolDefinition.cs
-
-
- SwiftMarshal\SwiftNominalTypeAttribute.cs
-
-
- SwiftMarshal\SwiftNominalTypeDescriptor.cs
-
-
- SwiftMarshal\SwiftProtocolConstraintAttribute.cs
-
-
- SwiftMarshal\SwiftProtocolTypeAttribute.cs
-
-
- SwiftMarshal\SwiftStandardMetatypes.cs
-
-
- SwiftMarshal\SwiftStructAttribute.cs
-
-
- SwiftMarshal\SwiftTupleMap.cs
-
-
- SwiftMarshal\SwiftValueWitnessTable.cs
-
-
- SwiftMarshal\SwiftNativeObjectAttribute.cs
-
-
- UnsafeMutablePointer.cs
-
-
- UnsafePointer.cs
-
-
- BlindSwiftClosureRepresentation.cs
-
-
- SwiftSet.cs
-
-
- ISwiftEquatable.cs
-
-
- SwiftEquatableProxy.cs
-
-
- ISwiftComparable.cs
-
-
- SwiftComparableProxy.cs
-
-
- ICustomStringConvertible.cs
-
-
- SwiftCharacter.cs
-
-
- Exceptions.cs
-
-
- SwiftMarshal\ImportedTypeCache.cs
-
-
- XamGlueConstants.cs
-
-
- SwiftCoreConstants.cs
-
-
- SymbolicatorInfoAttribute.cs
-
-
- SwiftMarshal\StringMemory.cs
-
-
- UnsafeRawPointer.cs
-
-
- UnsafeMutableRawBufferPointer.cs
-
-
- UnsafeRawBufferPointer.cs
-
-
- SwiftHasher.cs
-
-
- SwiftDate.cs
-
-
- SwiftFoundationConstants.cs
-
-
- EveryProtocol.cs
-
-
- ExistentialContainers.cs
-
-
- BaseProxy.cs
-
-
- SwiftMarshal\SwiftTypeNameAttribute.cs
-
-
- SwiftTypeRegistry.cs
-
-
- SwiftMarshal\SwiftProtocolConformanceDescriptor.cs
-
-
- SwiftMarshal\SwiftProtocolWitnessTable.cs
-
-
- SwiftMarshal\SwiftAssociatedTypeDescriptor.cs
-
-
- BaseAssociatedTypeProxy.cs
-
-
- SwiftNativeInstance.cs
-
-
- SwiftNativeObject.cs
-
-
- SwiftNativeValueType.cs
-
-
- ISwiftValueType.cs
-
-
- SwiftMarshal\SwiftThrowsAttribute.cs
-
-
- ISwiftIteratorProtocol.cs
-
-
- SwiftIteratorProtocolProxy.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ net7.0-macos
+ enable
+ true
+
+
+ false
+ false
+ __MACOS__;__UNIFIED__;TRACE;DEBUG;NET;NET7_0;NETCOREAPP;SWIFT;SWIFT4
+ 4
+ None
+ true
+
+
+ false
+ false
+ None
+ true
+
+
+
+ SwiftMarshal\StructMarshal.cs
+
+
+ SwiftMarshal\BlindClosureMapper.cs
+
+
+ SwiftMarshal\DynamicLib.cs
+
+
+ SwiftMarshal\Extensions.cs
+
+
+ SwiftMarshal\ImportedTypeCache.cs
+
+
+ SwiftMarshal\Memory.cs
+
+
+ SwiftMarshal\NominalSizeSet.cs
+
+
+ SwiftMarshal\StringMemory.cs
+
+
+ SwiftMarshal\SwiftAssociatedTypeDescriptor.cs
+
+
+ SwiftMarshal\SwiftClassObject.cs
+
+
+ SwiftMarshal\SwiftEnumBackingTypeAttribute.cs
+
+
+ SwiftMarshal\SwiftEnumTypeAttribute.cs
+
+
+ SwiftMarshal\SwiftExternalProtocolDefinition.cs
+
+
+ SwiftMarshal\SwiftNativeObjectAttribute.cs
+
+
+ SwiftMarshal\SwiftNominalTypeAttribute.cs
+
+
+ SwiftMarshal\SwiftNominalTypeDescriptor.cs
+
+
+ SwiftMarshal\SwiftProtocolConformanceDescriptor.cs
+
+
+ SwiftMarshal\SwiftProtocolConstraintAttribute.cs
+
+
+ SwiftMarshal\SwiftProtocolTypeAttribute.cs
+
+
+ SwiftMarshal\SwiftProtocolWitnessTable.cs
+
+
+ SwiftMarshal\SwiftStandardMetatypes.cs
+
+
+ SwiftMarshal\SwiftStructAttribute.cs
+
+
+ SwiftMarshal\SwiftThrowsAttribute.cs
+
+
+ SwiftMarshal\SwiftTupleMap.cs
+
+
+ SwiftMarshal\SwiftValueWitnessTable.cs
+
+
+ ISwiftObject.cs
+
+
+ SwiftArray.cs
+
+
+ SwiftClosureRepresentation.cs
+
+
+ SwiftComparableProxy.cs
+
+
+ SwiftDotNetCapsule.cs
+
+
+ SwiftEquatableProxy.cs
+
+
+ SwiftHashableProxy.cs
+
+
+ SwiftObjectRegistry.cs
+
+
+ BaseAssociatedTypeProxy.cs
+
+
+ BaseProxy.cs
+
+
+ BlindSwiftClosureRepresentation.cs
+
+
+ Enums.cs
+
+
+ EveryProtocol.cs
+
+
+ Exceptions.cs
+
+
+ ExistentialContainers.cs
+
+
+ ICustomStringConvertible.cs
+
+
+ ISwiftComparable.cs
+
+
+ ISwiftEquatable.cs
+
+
+ ISwiftError.cs
+
+
+ ISwiftHashable.cs
+
+
+ ISwiftIteratorProtocol.cs
+
+
+ ISwiftValueType.cs
+
+
+ RuntimeDebugging.cs
+
+
+ SwiftAnyObject.cs
+
+
+ SwiftCharacter.cs
+
+
+ SwiftCore.cs
+
+
+ SwiftDate.cs
+
+
+ SwiftDictionary.cs
+
+
+ SwiftEnumMapper.cs
+
+
+ SwiftEnumRawValueAttribute.cs
+
+
+ SwiftError.cs
+
+
+ SwiftException.cs
+
+
+ SwiftFoundationConstants.cs
+
+
+ SwiftHasher.cs
+
+
+ SwiftIteratorProtocolProxy.cs
+
+
+ SwiftMetatype.cs
+
+
+ SwiftNativeInstance.cs
+
+
+ SwiftNativeObject.cs
+
+
+ SwiftNativeValueType.cs
+
+
+ SwiftOptional.cs
+
+
+ SwiftRuntimeException.cs
+
+
+ SwiftSet.cs
+
+
+ SwiftString.cs
+
+
+ SwiftTypeRegistry.cs
+
+
+ UnsafeMutablePointer.cs
+
+
+ UnsafeMutableRawBufferPointer.cs
+
+
+ UnsafePointer.cs
+
+
+ UnsafeRawBufferPointer.cs
+
+
+ UnsafeRawPointer.cs
+
+
+ XamProxyTypeAttribute.cs
+
+
+ XamTrivialSwiftObject.cs
+
+
+ SwiftCoreConstants.cs
+
+
+ XamGlueConstants.cs
+
+
+ SymbolicatorInfoAttribute.cs
+
+
+ SwiftMarshal\SwiftTypeNameAttribute.cs
+
+
+
diff --git a/SwiftRuntimeLibrary.iOS/Properties/AssemblyInfo.cs b/SwiftRuntimeLibrary.iOS/Properties/AssemblyInfo.cs
deleted file mode 100644
index 8ea61b31..00000000
--- a/SwiftRuntimeLibrary.iOS/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes.
-// Change them to the values specific to your project.
-
-[assembly: AssemblyTitle("SwiftRuntimeLibrary.iOS")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("${AuthorCopyright}")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-
-[assembly: AssemblyVersion("1.0.*")]
-
-// The following attributes are used to specify the signing key for the assembly,
-// if desired. See the Mono documentation for more information about signing.
-
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]
diff --git a/SwiftRuntimeLibrary.iOS/SwiftRuntimeLibrary.iOS.csproj b/SwiftRuntimeLibrary.iOS/SwiftRuntimeLibrary.iOS.csproj
index 0f5f5ef9..887e29de 100644
--- a/SwiftRuntimeLibrary.iOS/SwiftRuntimeLibrary.iOS.csproj
+++ b/SwiftRuntimeLibrary.iOS/SwiftRuntimeLibrary.iOS.csproj
@@ -1,308 +1,266 @@
-
-
-
- Debug
- AnyCPU
- {03490BF4-3B9F-4D49-BD6E-F8D576578BE1}
- {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- Library
- SwiftRuntimeLibrary.iOS
- SwiftRuntimeLibrary.iOS
- Resources
-
-
- true
- full
- false
- bin\Debug
- __IOS__;__MOBILE__;__UNIFIED__;DEBUG;SWIFT;SWIFT4
- prompt
- 4
- iPhone Developer
- true
- true
- true
- true
- 16775
- false
- SdkOnly
- HttpClientHandler
- true
-
-
-
- true
- bin\Release
- __IOS__;__MOBILE__;__UNIFIED__;SWIFT;SWIFT4
- prompt
- 4
- iPhone Developer
- true
- SdkOnly
- HttpClientHandler
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SwiftAnyObject.cs
-
-
- Enums.cs
-
-
- ISwiftError.cs
-
-
- ISwiftHashable.cs
-
-
- ISwiftObject.cs
-
-
- MonoPInvokeCallbackAttribute.cs
-
-
- RuntimeDebugging.cs
-
-
- SwiftArray.cs
-
-
- SwiftClosureRepresentation.cs
-
-
- SwiftCore.cs
-
-
- SwiftDictionary.cs
-
-
- SwiftDotNetCapsule.cs
-
-
- SwiftEnumMapper.cs
-
-
- SwiftEnumRawValueAttribute.cs
-
-
- SwiftError.cs
-
-
- SwiftException.cs
-
-
- SwiftHashableProxy.cs
-
-
- SwiftMetatype.cs
-
-
- SwiftObjectRegistry.cs
-
-
- SwiftOptional.cs
-
-
- SwiftRuntimeException.cs
-
-
- SwiftString.cs
-
-
- XamProxyTypeAttribute.cs
-
-
- XamTrivialSwiftObject.cs
-
-
- SwiftMarshal\BlindClosureMapper.cs
-
-
- SwiftMarshal\DynamicLib.cs
-
-
- SwiftMarshal\Extentions.cs
-
-
- SwiftMarshal\Memory.cs
-
-
- SwiftMarshal\NominalSizeSet.cs
-
-
- SwiftMarshal\StructMarshal.cs
-
-
- SwiftMarshal\SwiftClassObject.cs
-
-
- SwiftMarshal\SwiftEnumBackingTypeAttribute.cs
-
-
- SwiftMarshal\SwiftEnumTypeAttribute.cs
-
-
- SwiftMarshal\SwiftExternalProtocolDefinition.cs
-
-
- SwiftMarshal\SwiftNominalTypeAttribute.cs
-
-
- SwiftMarshal\SwiftNominalTypeDescriptor.cs
-
-
- SwiftMarshal\SwiftProtocolConstraintAttribute.cs
-
-
- SwiftMarshal\SwiftProtocolTypeAttribute.cs
-
-
- SwiftMarshal\SwiftStandardMetatypes.cs
-
-
- SwiftMarshal\SwiftStructAttribute.cs
-
-
- SwiftMarshal\SwiftTupleMap.cs
-
-
- SwiftMarshal\SwiftValueWitnessTable.cs
-
-
- SwiftMarshal\SwiftNativeObjectAttribute.cs
-
-
- UnsafeMutablePointer.cs
-
-
- UnsafePointer.cs
-
-
- BlindSwiftClosureRepresentation.cs
-
-
- SwiftSet.cs
-
-
- ISwiftEquatable.cs
-
-
- SwiftEquatableProxy.cs
-
-
- ISwiftComparable.cs
-
-
- SwiftComparableProxy.cs
-
-
- ICustomStringConvertible.cs
-
-
- SwiftCharacter.cs
-
-
- Exceptions.cs
-
-
- SwiftMarshal\ImportedTypeCache.cs
-
-
- XamGlueConstants.cs
-
-
- SwiftCoreConstants.cs
-
-
- SymbolicatorInfoAttribute.cs
-
-
- SwiftMarshal\StringMemory.cs
-
-
- UnsafeRawPointer.cs
-
-
- UnsafeMutableRawBufferPointer.cs
-
-
- UnsafeRawBufferPointer.cs
-
-
- SwiftHasher.cs
-
-
- SwiftDate.cs
-
-
- SwiftFoundationConstants.cs
-
-
- EveryProtocol.cs
-
-
- BaseProxy.cs
-
-
- ExistentialContainers.cs
-
-
- SwiftMarshal\SwiftTypeNameAttribute.cs
-
-
- SwiftTypeRegistry.cs
-
-
- SwiftMarshal\SwiftProtocolConformanceDescriptor.cs
-
-
- SwiftMarshal\SwiftProtocolWitnessTable.cs
-
-
- SwiftMarshal\SwiftAssociatedTypeDescriptor.cs
-
-
- BaseAssociatedTypeProxy.cs
-
-
- SwiftNativeObject.cs
-
-
- SwiftNativeInstance.cs
-
-
- SwiftNativeValueType.cs
-
-
- ISwiftValueType.cs
-
-
- SwiftMarshal\SwiftThrowsAttribute.cs
-
-
- ISwiftIteratorProtocol.cs
-
-
- SwiftIteratorProtocolProxy.cs
-
-
-
-
-
-
-
-
-
-
+
+
+ net7.0-ios
+ enable
+ true
+
+
+ false
+ 4
+ true
+
+
+ false
+ true
+
+
+
+ SwiftMarshal\StructMarshal.cs
+
+
+ SwiftMarshal\BlindClosureMapper.cs
+
+
+ SwiftMarshal\DynamicLib.cs
+
+
+ SwiftMarshal\Extensions.cs
+
+
+ SwiftMarshal\ImportedTypeCache.cs
+
+
+ SwiftMarshal\Memory.cs
+
+
+ SwiftMarshal\NominalSizeSet.cs
+
+
+ SwiftMarshal\StringMemory.cs
+
+
+ SwiftMarshal\SwiftAssociatedTypeDescriptor.cs
+
+
+ SwiftMarshal\SwiftClassObject.cs
+
+
+ SwiftMarshal\SwiftEnumBackingTypeAttribute.cs
+
+
+ SwiftMarshal\SwiftEnumTypeAttribute.cs
+
+
+ SwiftMarshal\SwiftExternalProtocolDefinition.cs
+
+
+ SwiftMarshal\SwiftNativeObjectAttribute.cs
+
+
+ SwiftMarshal\SwiftNominalTypeAttribute.cs
+
+
+ SwiftMarshal\SwiftNominalTypeDescriptor.cs
+
+
+ SwiftMarshal\SwiftProtocolConformanceDescriptor.cs
+
+
+ SwiftMarshal\SwiftProtocolConstraintAttribute.cs
+
+
+ SwiftMarshal\SwiftProtocolTypeAttribute.cs
+
+
+ SwiftMarshal\SwiftProtocolWitnessTable.cs
+
+
+ SwiftMarshal\SwiftStandardMetatypes.cs
+
+
+ SwiftMarshal\SwiftStructAttribute.cs
+
+
+ SwiftMarshal\SwiftThrowsAttribute.cs
+
+
+ SwiftMarshal\SwiftTupleMap.cs
+
+
+ SwiftMarshal\SwiftTypeNameAttribute.cs
+
+
+ SwiftMarshal\SwiftValueWitnessTable.cs
+
+
+ ISwiftObject.cs
+
+
+ SwiftArray.cs
+
+
+ SwiftClosureRepresentation.cs
+
+
+ SwiftComparableProxy.cs
+
+
+ SwiftDotNetCapsule.cs
+
+
+ SwiftEquatableProxy.cs
+
+
+ SwiftHashableProxy.cs
+
+
+ SwiftObjectRegistry.cs
+
+
+ BaseAssociatedTypeProxy.cs
+
+
+ BaseProxy.cs
+
+
+ BlindSwiftClosureRepresentation.cs
+
+
+ Enums.cs
+
+
+ EveryProtocol.cs
+
+
+ Exceptions.cs
+
+
+ ExistentialContainers.cs
+
+
+ ICustomStringConvertible.cs
+
+
+ ISwiftComparable.cs
+
+
+ ISwiftEquatable.cs
+
+
+ ISwiftError.cs
+
+
+ ISwiftHashable.cs
+
+
+ ISwiftIteratorProtocol.cs
+
+
+ ISwiftValueType.cs
+
+
+ RuntimeDebugging.cs
+
+
+ SwiftAnyObject.cs
+
+
+ SwiftCharacter.cs
+
+
+ SwiftCore.cs
+
+
+ SwiftDate.cs
+
+
+ SwiftDictionary.cs
+
+
+ SwiftEnumMapper.cs
+
+
+ SwiftEnumRawValueAttribute.cs
+
+
+ SwiftError.cs
+
+
+ SwiftException.cs
+
+
+ SwiftFoundationConstants.cs
+
+
+ SwiftHasher.cs
+
+
+ SwiftIteratorProtocolProxy.cs
+
+
+ SwiftMetatype.cs
+
+
+ SwiftNativeInstance.cs
+
+
+ SwiftNativeObject.cs
+
+
+ SwiftNativeValueType.cs
+
+
+ SwiftOptional.cs
+
+
+ SwiftRuntimeException.cs
+
+
+ SwiftSet.cs
+
+
+ SwiftString.cs
+
+
+ SwiftTypeRegistry.cs
+
+
+ UnsafeMutablePointer.cs
+
+
+ UnsafeMutableRawBufferPointer.cs
+
+
+ UnsafePointer.cs
+
+
+ UnsafeRawBufferPointer.cs
+
+
+ UnsafeRawPointer.cs
+
+
+ XamProxyTypeAttribute.cs
+
+
+ XamTrivialSwiftObject.cs
+
+
+ SwiftCoreConstants.cs
+
+
+ SymbolicatorInfoAttribute.cs
+
+
+ XamGlueConstants.cs
+
+
+
+
+ SwiftRuntimeLibrary.csproj
+
+
+ Makefile
+
+
+
diff --git a/SwiftRuntimeLibrary/ICustomStringConvertible.cs b/SwiftRuntimeLibrary/ICustomStringConvertible.cs
index 42f6af6a..fc5c0bde 100644
--- a/SwiftRuntimeLibrary/ICustomStringConvertible.cs
+++ b/SwiftRuntimeLibrary/ICustomStringConvertible.cs
@@ -5,9 +5,6 @@
using System.Runtime.InteropServices;
using SwiftRuntimeLibrary;
using SwiftRuntimeLibrary.SwiftMarshal;
-#if __IOS__
-using Xamarin.iOS;
-#endif
namespace SwiftRuntimeLibrary {
[SwiftTypeName ("Swift.CustomStringConvertible")]
@@ -41,9 +38,7 @@ public CustomStringConvertibleXamProxy (ISwiftExistentialContainer container)
public override ISwiftExistentialContainer ProxyExistentialContainer => container;
-#if __IOS__
- [MonoPInvokeCallback (typeof (CustomStringConvertible_xam_vtable.Delfunc0))]
-#endif
+ [UnmanagedCallersOnly]
static void xamVtable_recv_get_Description (IntPtr xam_retval, IntPtr self)
{
var container = new SwiftExistentialContainer1 (self);
@@ -54,14 +49,11 @@ static void xamVtable_recv_get_Description (IntPtr xam_retval, IntPtr self)
static void XamSetVTable ()
{
- xamVtableICustomStringConvertible.func0 = xamVtable_recv_get_Description;
unsafe {
-
+ xamVtableICustomStringConvertible.func0 = &xamVtable_recv_get_Description;
byte* vtData = stackalloc byte [Marshal.SizeOf (xamVtableICustomStringConvertible)];
-
- IntPtr vtPtr = new IntPtr (vtData);
- Marshal.WriteIntPtr (vtPtr, Marshal.GetFunctionPointerForDelegate (xamVtableICustomStringConvertible.func0));
- NativeMethodsForICustomStringConvertible.SwiftXamSetVtable (vtPtr);
+ Marshal.WriteIntPtr ((IntPtr)vtData, (IntPtr)xamVtableICustomStringConvertible.func0);
+ NativeMethodsForICustomStringConvertible.SwiftXamSetVtable ((IntPtr)vtData);
}
}
@@ -81,9 +73,7 @@ public SwiftString Description {
}
struct CustomStringConvertible_xam_vtable {
- public delegate void Delfunc0 (IntPtr xam_retval, IntPtr self);
- [MarshalAs (UnmanagedType.FunctionPtr)]
- public Delfunc0 func0;
+ public unsafe delegate *unmanaged func0;
}
static IntPtr protocolWitnessTable;
diff --git a/SwiftRuntimeLibrary/Makefile b/SwiftRuntimeLibrary/Makefile
index 0e9012d8..cc686e44 100644
--- a/SwiftRuntimeLibrary/Makefile
+++ b/SwiftRuntimeLibrary/Makefile
@@ -5,7 +5,7 @@ include $(TOP)/Make.config
configuration ?= debug
BINDING_METADATA_IOS = SwiftRuntimeLibrary.iOS/GeneratedCode/BindingMetadata.iOS.cs
BINDING_METADATA_MAC = SwiftRuntimeLibrary.Mac/GeneratedCode/BindingMetadata.MacOS.cs
-TYPE_O_MATIC_EXE = $(TOP)/type-o-matic/bin/Debug/type-o-matic.exe
+TYPE_O_MATIC_EXE = $(TOP)/type-o-matic/bin/Debug/net7.0/type-o-matic
XAMGLUE_IOS = $(TOP)/swiftglue/bin/$(configuration)/iphone/FinalProduct/XamGlue.xcframework/ios-x86_64-simulator/XamGlue.framework
XAMGLUE_MAC = $(TOP)/swiftglue/bin/$(configuration)/mac/FinalProduct/XamGlue.framework
SWIFT_LIB_PATH = $(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0
@@ -27,14 +27,14 @@ clean: clean-ios clean-mac
$(TOP)/$(BINDING_METADATA_IOS): $(TYPE_O_MATIC_EXE) $(TOP)/common.mk $(XAMGLUE_IOS)
@echo "Generating code for iOS..."
@mkdir -p $(TOP)/SwiftRuntimeLibrary.iOS/GeneratedCode
- @/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono $(TYPE_O_MATIC_EXE) --swift-lib-path=$(SWIFT_LIB_PATH) --platform=iphone --generate=csharp $(addprefix --namespace=, $(TYPE_O_MATIC_IOS_NAMESPACES)) --xamglue-framework=$(XAMGLUE_IOS) --output=$@
+ @$(TYPE_O_MATIC_EXE) --swift-lib-path=$(SWIFT_LIB_PATH) --platform=iphone --generate=csharp $(addprefix --namespace=, $(TYPE_O_MATIC_IOS_NAMESPACES)) --xamglue-framework=$(XAMGLUE_IOS) --output=$@
@echo "Generated C# binding metadata files for iOS at $@"
$(TOP)/$(BINDING_METADATA_MAC): $(TYPE_O_MATIC_EXE) $(TOP)/common.mk $(XAMGLUE_MAC)
@echo "Generating code for MacOS..."
@echo "Swift library path: " $(SWIFT_LIB_PATH)
@mkdir -p $(TOP)/SwiftRuntimeLibrary.Mac/GeneratedCode
- @/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono $(TYPE_O_MATIC_EXE) --swift-lib-path=$(SWIFT_LIB_PATH) --platform=mac --generate=csharp $(addprefix --namespace=, $(TYPE_O_MATIC_MAC_NAMESPACES)) --xamglue-framework=$(XAMGLUE_MAC) --output=$@
+ @$(TYPE_O_MATIC_EXE) --swift-lib-path=$(SWIFT_LIB_PATH) --platform=mac --generate=csharp $(addprefix --namespace=, $(TYPE_O_MATIC_MAC_NAMESPACES)) --xamglue-framework=$(XAMGLUE_MAC) --output=$@
@echo "Generated C# binding metadata files for MacOS at $@"
create-pinvokes: $(TOP)/$(BINDING_METADATA_MAC) $(TOP)/$(BINDING_METADATA_IOS)
diff --git a/SwiftRuntimeLibrary/MonoPInvokeCallbackAttribute.cs b/SwiftRuntimeLibrary/MonoPInvokeCallbackAttribute.cs
deleted file mode 100644
index 22bc90dd..00000000
--- a/SwiftRuntimeLibrary/MonoPInvokeCallbackAttribute.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using System;
-
-namespace Xamarin.iOS {
- // this is not the actual attribute - FIXME
- public class MonoPInvokeCallbackAttribute : Attribute {
- public MonoPInvokeCallbackAttribute (Type delegateType)
- {
- DelegateType = delegateType;
- }
-
- public Type DelegateType { get; set; }
- }
-}
diff --git a/SwiftRuntimeLibrary/NIntNUInt.cs b/SwiftRuntimeLibrary/NIntNUInt.cs
deleted file mode 100644
index a15a000b..00000000
--- a/SwiftRuntimeLibrary/NIntNUInt.cs
+++ /dev/null
@@ -1,388 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using System;
-using System.Globalization;
-using System.Runtime.CompilerServices;
-
-namespace System {
- [Serializable]
- public struct nint : IFormattable, IConvertible, IComparable, IComparable, IEquatable {
- public nint (nint v) { this.v = v.v; }
- public nint (Int32 v) { this.v = v; }
-
-#if ARCH_32
- public static readonly nint MaxValue = Int32.MaxValue;
- public static readonly nint MinValue = Int32.MinValue;
-
- public Int32 v;
-
- public nint (Int64 v) { this.v = (Int32)v; }
-#else
- public static readonly nint MaxValue = Int32.MaxValue;
- public static readonly nint MinValue = Int32.MinValue;
-
- Int64 v;
-
- public nint (Int64 v) { this.v = v; }
-#endif
-
-#if ARCH_32
-#if NINT_JIT_OPTIMIZED
- public static implicit operator Int32 (nint v) { throw new NotImplementedException (); }
- public static implicit operator nint (Int32 v) { throw new NotImplementedException (); }
- public static implicit operator Int64 (nint v) { throw new NotImplementedException (); }
- public static explicit operator nint (Int64 v) { throw new NotImplementedException (); }
-#else
- public static implicit operator Int32 (nint v) { return v.v; }
- public static implicit operator nint (Int32 v) { return new nint (v); }
- public static implicit operator Int64 (nint v) { return (Int64)v.v; }
- public static explicit operator nint (Int64 v) { return new nint (v); }
-#endif
-#else
-#if NINT_JIT_OPTIMIZED
- public static explicit operator Int32 (nint v) { throw new NotImplementedException (); }
- public static implicit operator nint (Int32 v) { throw new NotImplementedException (); }
- public static implicit operator Int64 (nint v) { throw new NotImplementedException (); }
- public static implicit operator nint (Int64 v) { throw new NotImplementedException (); }
-#else
- public static explicit operator Int32 (nint v) { return (Int32)v.v; }
- public static implicit operator nint (Int32 v) { return new nint (v); }
- public static implicit operator Int64 (nint v) { return v.v; }
- public static implicit operator nint (Int64 v) { return new nint (v); }
-#endif
-#endif
-
-#if NINT_JIT_OPTIMIZED
- public static nint operator + (nint v) { throw new NotImplementedException (); }
- public static nint operator - (nint v) { throw new NotImplementedException (); }
- public static nint operator ~ (nint v) { throw new NotImplementedException (); }
-#else
- public static nint operator + (nint v) { return new nint (+v.v); }
- public static nint operator - (nint v) { return new nint (-v.v); }
- public static nint operator ~ (nint v) { return new nint (~v.v); }
-#endif
-
-#if NINT_JIT_OPTIMIZED
- public static nint operator ++ (nint v) { throw new NotImplementedException (); }
- public static nint operator -- (nint v) { throw new NotImplementedException (); }
-#else
- [MethodImpl (MethodImplOptions.AggressiveInlining)]
- public static nint operator ++ (nint v) { return new nint (v.v + 1); }
- public static nint operator -- (nint v) { return new nint (v.v - 1); }
-#endif
-
-#if NINT_JIT_OPTIMIZED
- public static nint operator + (nint l, nint r) { throw new NotImplementedException (); }
- public static nint operator - (nint l, nint r) { throw new NotImplementedException (); }
- public static nint operator * (nint l, nint r) { throw new NotImplementedException (); }
- public static nint operator / (nint l, nint r) { throw new NotImplementedException (); }
- public static nint operator % (nint l, nint r) { throw new NotImplementedException (); }
- public static nint operator & (nint l, nint r) { throw new NotImplementedException (); }
- public static nint operator | (nint l, nint r) { throw new NotImplementedException (); }
- public static nint operator ^ (nint l, nint r) { throw new NotImplementedException (); }
-
- public static nint operator << (nint l, int r) { throw new NotImplementedException (); }
- public static nint operator >> (nint l, int r) { throw new NotImplementedException (); }
-#else
- public static nint operator + (nint l, nint r) { return new nint (l.v + r.v); }
- public static nint operator - (nint l, nint r) { return new nint (l.v - r.v); }
- public static nint operator * (nint l, nint r) { return new nint (l.v * r.v); }
- public static nint operator / (nint l, nint r) { return new nint (l.v / r.v); }
- public static nint operator % (nint l, nint r) { return new nint (l.v % r.v); }
- public static nint operator & (nint l, nint r) { return new nint (l.v & r.v); }
- public static nint operator | (nint l, nint r) { return new nint (l.v | r.v); }
- public static nint operator ^ (nint l, nint r) { return new nint (l.v ^ r.v); }
-
- public static nint operator << (nint l, int r) { return new nint (l.v << r); }
- public static nint operator >> (nint l, int r) { return new nint (l.v >> r); }
-#endif
-
-#if NINT_JIT_OPTIMIZED
- public static bool operator == (nint l, nint r) { throw new NotImplementedException (); }
- public static bool operator != (nint l, nint r) { throw new NotImplementedException (); }
- public static bool operator < (nint l, nint r) { throw new NotImplementedException (); }
- public static bool operator > (nint l, nint r) { throw new NotImplementedException (); }
- public static bool operator <= (nint l, nint r) { throw new NotImplementedException (); }
- public static bool operator >= (nint l, nint r) { throw new NotImplementedException (); }
-#else
- public static bool operator == (nint l, nint r) { return l.v == r.v; }
- public static bool operator != (nint l, nint r) { return l.v != r.v; }
- public static bool operator < (nint l, nint r) { return l.v < r.v; }
- public static bool operator > (nint l, nint r) { return l.v > r.v; }
- public static bool operator <= (nint l, nint r) { return l.v <= r.v; }
- public static bool operator >= (nint l, nint r) { return l.v >= r.v; }
-#endif
-
- public int CompareTo (nint value) { return v.CompareTo (value.v); }
- public int CompareTo (object value) { return v.CompareTo (value); }
- public bool Equals (nint obj) { return v.Equals (obj.v); }
- public override bool Equals (object obj) { return v.Equals (obj); }
- public override int GetHashCode () { return v.GetHashCode (); }
-
-#if ARCH_32
- public static nint Parse (string s, IFormatProvider provider) { return Int32.Parse (s, provider); }
- public static nint Parse (string s, NumberStyles style) { return Int32.Parse (s, style); }
- public static nint Parse (string s) { return Int32.Parse (s); }
- public static nint Parse (string s, NumberStyles style, IFormatProvider provider) {
- return Int32.Parse (s, style, provider);
- }
-
- public static bool TryParse (string s, out nint result)
- {
- Int32 v;
- var r = Int32.TryParse (s, out v);
- result = v;
- return r;
- }
-
- public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nint result)
- {
- Int32 v;
- var r = Int32.TryParse (s, style, provider, out v);
- result = v;
- return r;
- }
-#else
- public static nint Parse (string s, IFormatProvider provider) { return Int64.Parse (s, provider); }
- public static nint Parse (string s, NumberStyles style) { return Int64.Parse (s, style); }
- public static nint Parse (string s) { return Int64.Parse (s); }
- public static nint Parse (string s, NumberStyles style, IFormatProvider provider)
- {
- return Int64.Parse (s, style, provider);
- }
-
- public static bool TryParse (string s, out nint result)
- {
- Int64 v;
- var r = Int64.TryParse (s, out v);
- result = v;
- return r;
- }
-
- public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nint result)
- {
- Int64 v;
- var r = Int64.TryParse (s, style, provider, out v);
- result = v;
- return r;
- }
-#endif
-
- public override string ToString () { return v.ToString (); }
- public string ToString (IFormatProvider provider) { return v.ToString (provider); }
- public string ToString (string format) { return v.ToString (format); }
- public string ToString (string format, IFormatProvider provider) { return v.ToString (format, provider); }
-
- public TypeCode GetTypeCode () { return v.GetTypeCode (); }
-
- bool IConvertible.ToBoolean (IFormatProvider provider) { return ((IConvertible)v).ToBoolean (provider); }
- byte IConvertible.ToByte (IFormatProvider provider) { return ((IConvertible)v).ToByte (provider); }
- char IConvertible.ToChar (IFormatProvider provider) { return ((IConvertible)v).ToChar (provider); }
- DateTime IConvertible.ToDateTime (IFormatProvider provider) { return ((IConvertible)v).ToDateTime (provider); }
- decimal IConvertible.ToDecimal (IFormatProvider provider) { return ((IConvertible)v).ToDecimal (provider); }
- double IConvertible.ToDouble (IFormatProvider provider) { return ((IConvertible)v).ToDouble (provider); }
- short IConvertible.ToInt16 (IFormatProvider provider) { return ((IConvertible)v).ToInt16 (provider); }
- int IConvertible.ToInt32 (IFormatProvider provider) { return ((IConvertible)v).ToInt32 (provider); }
- long IConvertible.ToInt64 (IFormatProvider provider) { return ((IConvertible)v).ToInt64 (provider); }
- sbyte IConvertible.ToSByte (IFormatProvider provider) { return ((IConvertible)v).ToSByte (provider); }
- float IConvertible.ToSingle (IFormatProvider provider) { return ((IConvertible)v).ToSingle (provider); }
- ushort IConvertible.ToUInt16 (IFormatProvider provider) { return ((IConvertible)v).ToUInt16 (provider); }
- uint IConvertible.ToUInt32 (IFormatProvider provider) { return ((IConvertible)v).ToUInt32 (provider); }
- ulong IConvertible.ToUInt64 (IFormatProvider provider) { return ((IConvertible)v).ToUInt64 (provider); }
-
- object IConvertible.ToType (Type targetType, IFormatProvider provider)
- {
- return ((IConvertible)v).ToType (targetType, provider);
- }
- }
-
- [Serializable]
- public struct nuint : IFormattable, IConvertible, IComparable, IComparable, IEquatable {
- public nuint (nuint v) { this.v = v.v; }
- public nuint (UInt32 v) { this.v = v; }
-
-#if ARCH_32
- public static readonly nuint MaxValue = UInt32.MaxValue;
- public static readonly nuint MinValue = UInt32.MinValue;
-
- UInt32 v;
-
- public nuint (UInt64 v) { this.v = (UInt32)v; }
-#else
- public static readonly nuint MaxValue = UInt32.MaxValue;
- public static readonly nuint MinValue = UInt32.MinValue;
-
- UInt64 v;
-
- public nuint (UInt64 v) { this.v = v; }
-#endif
-
-#if ARCH_32
-#if NINT_JIT_OPTIMIZED
- public static implicit operator UInt32 (nuint v) { throw new NotImplementedException (); }
- public static implicit operator nuint (UInt32 v) { throw new NotImplementedException (); }
- public static implicit operator UInt64 (nuint v) { throw new NotImplementedException (); }
- public static explicit operator nuint (UInt64 v) { throw new NotImplementedException (); }
-#else
- public static implicit operator UInt32 (nuint v) { return v.v; }
- public static implicit operator nuint (UInt32 v) { return new nuint (v); }
- public static implicit operator UInt64 (nuint v) { return (UInt64)v.v; }
- public static explicit operator nuint (UInt64 v) { return new nuint (v); }
-#endif
-#else
-#if NINT_JIT_OPTIMIZED
- public static explicit operator UInt32 (nuint v) { throw new NotImplementedException (); }
- public static implicit operator nuint (UInt32 v) { throw new NotImplementedException (); }
- public static implicit operator UInt64 (nuint v) { throw new NotImplementedException (); }
- public static implicit operator nuint (UInt64 v) { throw new NotImplementedException (); }
-#else
- public static explicit operator UInt32 (nuint v) { return (UInt32)v.v; }
- public static implicit operator nuint (UInt32 v) { return new nuint (v); }
- public static implicit operator UInt64 (nuint v) { return v.v; }
- public static implicit operator nuint (UInt64 v) { return new nuint (v); }
-#endif
-#endif
-
-#if NINT_JIT_OPTIMIZED
- public static nuint operator + (nuint v) { throw new NotImplementedException (); }
- public static nuint operator ~ (nuint v) { throw new NotImplementedException (); }
-#else
- public static nuint operator + (nuint v) { return new nuint (+v.v); }
- public static nuint operator ~ (nuint v) { return new nuint (~v.v); }
-#endif
-
-#if NINT_JIT_OPTIMIZED
- public static nuint operator ++ (nuint v) { throw new NotImplementedException (); }
- public static nuint operator -- (nuint v) { throw new NotImplementedException (); }
-#else
- [MethodImpl (MethodImplOptions.AggressiveInlining)]
- public static nuint operator ++ (nuint v) { return new nuint (v.v + 1); }
- public static nuint operator -- (nuint v) { return new nuint (v.v - 1); }
-#endif
-
-#if NINT_JIT_OPTIMIZED
- public static nuint operator + (nuint l, nuint r) { throw new NotImplementedException (); }
- public static nuint operator - (nuint l, nuint r) { throw new NotImplementedException (); }
- public static nuint operator * (nuint l, nuint r) { throw new NotImplementedException (); }
- public static nuint operator / (nuint l, nuint r) { throw new NotImplementedException (); }
- public static nuint operator % (nuint l, nuint r) { throw new NotImplementedException (); }
- public static nuint operator & (nuint l, nuint r) { throw new NotImplementedException (); }
- public static nuint operator | (nuint l, nuint r) { throw new NotImplementedException (); }
- public static nuint operator ^ (nuint l, nuint r) { throw new NotImplementedException (); }
-
- public static nuint operator << (nuint l, int r) { throw new NotImplementedException (); }
- public static nuint operator >> (nuint l, int r) { throw new NotImplementedException (); }
-#else
- public static nuint operator + (nuint l, nuint r) { return new nuint (l.v + r.v); }
- public static nuint operator - (nuint l, nuint r) { return new nuint (l.v - r.v); }
- public static nuint operator * (nuint l, nuint r) { return new nuint (l.v * r.v); }
- public static nuint operator / (nuint l, nuint r) { return new nuint (l.v / r.v); }
- public static nuint operator % (nuint l, nuint r) { return new nuint (l.v % r.v); }
- public static nuint operator & (nuint l, nuint r) { return new nuint (l.v & r.v); }
- public static nuint operator | (nuint l, nuint r) { return new nuint (l.v | r.v); }
- public static nuint operator ^ (nuint l, nuint r) { return new nuint (l.v ^ r.v); }
-
- public static nuint operator << (nuint l, int r) { return new nuint (l.v << r); }
- public static nuint operator >> (nuint l, int r) { return new nuint (l.v >> r); }
-#endif
-
-#if NINT_JIT_OPTIMIZED
- public static bool operator == (nuint l, nuint r) { throw new NotImplementedException (); }
- public static bool operator != (nuint l, nuint r) { throw new NotImplementedException (); }
- public static bool operator < (nuint l, nuint r) { throw new NotImplementedException (); }
- public static bool operator > (nuint l, nuint r) { throw new NotImplementedException (); }
- public static bool operator <= (nuint l, nuint r) { throw new NotImplementedException (); }
- public static bool operator >= (nuint l, nuint r) { throw new NotImplementedException (); }
-#else
- public static bool operator == (nuint l, nuint r) { return l.v == r.v; }
- public static bool operator != (nuint l, nuint r) { return l.v != r.v; }
- public static bool operator < (nuint l, nuint r) { return l.v < r.v; }
- public static bool operator > (nuint l, nuint r) { return l.v > r.v; }
- public static bool operator <= (nuint l, nuint r) { return l.v <= r.v; }
- public static bool operator >= (nuint l, nuint r) { return l.v >= r.v; }
-#endif
-
- public int CompareTo (nuint value) { return v.CompareTo (value.v); }
- public int CompareTo (object value) { return v.CompareTo (value); }
- public bool Equals (nuint obj) { return v.Equals (obj.v); }
- public override bool Equals (object obj) { return v.Equals (obj); }
- public override int GetHashCode () { return v.GetHashCode (); }
-
-#if ARCH_32
- public static nuint Parse (string s, IFormatProvider provider) { return UInt32.Parse (s, provider); }
- public static nuint Parse (string s, NumberStyles style) { return UInt32.Parse (s, style); }
- public static nuint Parse (string s) { return UInt32.Parse (s); }
- public static nuint Parse (string s, NumberStyles style, IFormatProvider provider) {
- return UInt32.Parse (s, style, provider);
- }
-
- public static bool TryParse (string s, out nuint result)
- {
- UInt32 v;
- var r = UInt32.TryParse (s, out v);
- result = v;
- return r;
- }
-
- public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nuint result)
- {
- UInt32 v;
- var r = UInt32.TryParse (s, style, provider, out v);
- result = v;
- return r;
- }
-#else
- public static nuint Parse (string s, IFormatProvider provider) { return UInt64.Parse (s, provider); }
- public static nuint Parse (string s, NumberStyles style) { return UInt64.Parse (s, style); }
- public static nuint Parse (string s) { return UInt64.Parse (s); }
- public static nuint Parse (string s, NumberStyles style, IFormatProvider provider)
- {
- return UInt64.Parse (s, style, provider);
- }
-
- public static bool TryParse (string s, out nuint result)
- {
- UInt64 v;
- var r = UInt64.TryParse (s, out v);
- result = v;
- return r;
- }
-
- public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nuint result)
- {
- UInt64 v;
- var r = UInt64.TryParse (s, style, provider, out v);
- result = v;
- return r;
- }
-#endif
-
- public override string ToString () { return v.ToString (); }
- public string ToString (IFormatProvider provider) { return v.ToString (provider); }
- public string ToString (string format) { return v.ToString (format); }
- public string ToString (string format, IFormatProvider provider) { return v.ToString (format, provider); }
-
- public TypeCode GetTypeCode () { return v.GetTypeCode (); }
-
- bool IConvertible.ToBoolean (IFormatProvider provider) { return ((IConvertible)v).ToBoolean (provider); }
- byte IConvertible.ToByte (IFormatProvider provider) { return ((IConvertible)v).ToByte (provider); }
- char IConvertible.ToChar (IFormatProvider provider) { return ((IConvertible)v).ToChar (provider); }
- DateTime IConvertible.ToDateTime (IFormatProvider provider) { return ((IConvertible)v).ToDateTime (provider); }
- decimal IConvertible.ToDecimal (IFormatProvider provider) { return ((IConvertible)v).ToDecimal (provider); }
- double IConvertible.ToDouble (IFormatProvider provider) { return ((IConvertible)v).ToDouble (provider); }
- short IConvertible.ToInt16 (IFormatProvider provider) { return ((IConvertible)v).ToInt16 (provider); }
- int IConvertible.ToInt32 (IFormatProvider provider) { return ((IConvertible)v).ToInt32 (provider); }
- long IConvertible.ToInt64 (IFormatProvider provider) { return ((IConvertible)v).ToInt64 (provider); }
- sbyte IConvertible.ToSByte (IFormatProvider provider) { return ((IConvertible)v).ToSByte (provider); }
- float IConvertible.ToSingle (IFormatProvider provider) { return ((IConvertible)v).ToSingle (provider); }
- ushort IConvertible.ToUInt16 (IFormatProvider provider) { return ((IConvertible)v).ToUInt16 (provider); }
- uint IConvertible.ToUInt32 (IFormatProvider provider) { return ((IConvertible)v).ToUInt32 (provider); }
- ulong IConvertible.ToUInt64 (IFormatProvider provider) { return ((IConvertible)v).ToUInt64 (provider); }
-
- object IConvertible.ToType (Type targetType, IFormatProvider provider)
- {
- return ((IConvertible)v).ToType (targetType, provider);
- }
- }
-}
diff --git a/SwiftRuntimeLibrary/Properties/AssemblyInfo.cs b/SwiftRuntimeLibrary/Properties/AssemblyInfo.cs
index d2d032dd..65e847d2 100644
--- a/SwiftRuntimeLibrary/Properties/AssemblyInfo.cs
+++ b/SwiftRuntimeLibrary/Properties/AssemblyInfo.cs
@@ -20,7 +20,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion ("1.0.*")]
+[assembly: AssemblyVersion ("1.0.0")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
diff --git a/SwiftRuntimeLibrary/SwiftArray.cs b/SwiftRuntimeLibrary/SwiftArray.cs
index db03f021..d36ba89f 100644
--- a/SwiftRuntimeLibrary/SwiftArray.cs
+++ b/SwiftRuntimeLibrary/SwiftArray.cs
@@ -23,7 +23,7 @@ byte [] CheckedSwiftData {
}
public SwiftArray (nint capacity)
- : this (NativeMethodsForSwiftArray.NewArray (ValidateCapacity (capacity), ElementMetatype))
+ : this (NativeMethodsForSwiftArray.NewArray (ValidateCapacity (capacity), ElementMetatype), SwiftValueTypeCtorArgument.None)
{
}
@@ -34,7 +34,7 @@ static nint ValidateCapacity (nint capacity)
return capacity;
}
- internal SwiftArray (IntPtr p)
+ internal SwiftArray (IntPtr p, SwiftValueTypeCtorArgument unused)
: this (SwiftValueTypeCtorArgument.None)
{
CheckedSwiftData.WriteIntPtr (p, offset: 0);
diff --git a/SwiftRuntimeLibrary/SwiftClosureRepresentation.cs b/SwiftRuntimeLibrary/SwiftClosureRepresentation.cs
index db9f7418..8daeaa8f 100644
--- a/SwiftRuntimeLibrary/SwiftClosureRepresentation.cs
+++ b/SwiftRuntimeLibrary/SwiftClosureRepresentation.cs
@@ -4,11 +4,10 @@
using System;
using System.Runtime.InteropServices;
using SwiftRuntimeLibrary.SwiftMarshal;
-using Xamarin.iOS;
namespace SwiftRuntimeLibrary {
public struct SwiftClosureRepresentation {
- public SwiftClosureRepresentation (Delegate function, IntPtr data)
+ public unsafe SwiftClosureRepresentation (void *function, IntPtr data)
{
Function = function;
Data = data;
@@ -16,8 +15,7 @@ public SwiftClosureRepresentation (Delegate function, IntPtr data)
//Console.WriteLine ($"Constructed SwiftClosureRepresentation with data {data.ToString ("X8")}");
#endif
}
- [MarshalAs (UnmanagedType.FunctionPtr)]
- public Delegate Function;
+ public unsafe void *Function;
public IntPtr Data;
@@ -27,7 +25,7 @@ static IntPtr LocateRefPtrFromPartialApplicationForwarder(IntPtr p)
return Marshal.ReadIntPtr (p + 3 * IntPtr.Size);
}
- [MonoPInvokeCallback (typeof (Action))]
+ [UnmanagedCallersOnly]
public static void FuncCallbackVoid (IntPtr retValPtr, IntPtr refPtr)
{
if (refPtr == IntPtr.Zero)
@@ -41,7 +39,7 @@ public static void FuncCallbackVoid (IntPtr retValPtr, IntPtr refPtr)
StructMarshal.ReleaseSwiftObject (capsule);
}
- [MonoPInvokeCallback (typeof (Action))]
+ [UnmanagedCallersOnly]
public static void FuncCallback (IntPtr retValPtr, IntPtr args, IntPtr refPtr)
{
if (refPtr == IntPtr.Zero)
@@ -73,14 +71,19 @@ public static void FuncCallback (IntPtr retValPtr, IntPtr args, IntPtr refPtr)
StructMarshal.ReleaseSwiftObject (capsule);
}
- [MonoPInvokeCallback (typeof (Action))]
+ [UnmanagedCallersOnly]
public static void FuncCallbackVoidMaybeThrows (IntPtr retValPtr, IntPtr refPtr)
{
- FuncCallbackMaybeThrows (retValPtr, IntPtr.Zero, refPtr);
+ FuncCallbackMaybeThrowsImpl (retValPtr, IntPtr.Zero, refPtr);
}
- [MonoPInvokeCallback (typeof (Action))]
+ [UnmanagedCallersOnly]
public static void FuncCallbackMaybeThrows (IntPtr retValPtr, IntPtr args, IntPtr refPtr)
+ {
+ FuncCallbackMaybeThrowsImpl (retValPtr, IntPtr.Zero, refPtr);
+ }
+
+ static void FuncCallbackMaybeThrowsImpl (IntPtr retValPtr, IntPtr args, IntPtr refPtr)
{
// instead of a pointer to a return value, this is a pointer to a Medusa tuple of the form:
// (T, SwiftError, bool)
@@ -152,7 +155,7 @@ public static void FuncCallbackMaybeThrows (IntPtr retValPtr, IntPtr args, IntPt
StructMarshal.ReleaseSwiftObject (capsule);
}
- [MonoPInvokeCallback (typeof (Action))]
+ [UnmanagedCallersOnly]
public static void ActionCallbackVoidVoid (IntPtr refPtr)
{
if (refPtr == IntPtr.Zero)
@@ -174,7 +177,7 @@ public static void ActionCallbackVoidVoid (IntPtr refPtr)
}
- [MonoPInvokeCallback (typeof (Action))]
+ [UnmanagedCallersOnly]
public static void ActionCallback (IntPtr args, IntPtr refPtr)
{
if (refPtr == IntPtr.Zero)
diff --git a/SwiftRuntimeLibrary/SwiftComparableProxy.cs b/SwiftRuntimeLibrary/SwiftComparableProxy.cs
index 311d2ee3..38fb807f 100644
--- a/SwiftRuntimeLibrary/SwiftComparableProxy.cs
+++ b/SwiftRuntimeLibrary/SwiftComparableProxy.cs
@@ -4,7 +4,6 @@
using System;
using System.Runtime.InteropServices;
using SwiftRuntimeLibrary.SwiftMarshal;
-using Xamarin.iOS;
namespace SwiftRuntimeLibrary {
public class SwiftComparableProxy : BaseProxy, ISwiftComparable {
@@ -23,11 +22,10 @@ public SwiftComparableProxy (ISwiftExistentialContainer container)
}
struct Comparable_xam_vtable {
- public delegate bool Delfunc0 (IntPtr one, IntPtr two);
[MarshalAs (UnmanagedType.FunctionPtr)]
- public Delfunc0 opEqualFunc;
+ public unsafe delegate* unmanaged opEqualFunc;
[MarshalAs (UnmanagedType.FunctionPtr)]
- public Delfunc0 opLessFunc;
+ public unsafe delegate* unmanaged opLessFunc;
}
static Comparable_xam_vtable vtableIComparable;
@@ -36,9 +34,7 @@ static SwiftComparableProxy ()
XamSetVTable ();
}
-#if __IOS__
- [MonoPInvokeCallback(typeof(Comparable_xam_vtable.Delfunc0))]
-#endif
+ [UnmanagedCallersOnly]
static bool EqFunc (IntPtr oneptr, IntPtr twoptr)
{
if (oneptr == twoptr)
@@ -48,9 +44,7 @@ static bool EqFunc (IntPtr oneptr, IntPtr twoptr)
return one.OpEquals (two);
}
-#if __IOS__
- [MonoPInvokeCallback(typeof(Comparable_xam_vtable.Delfunc0))]
-#endif
+ [UnmanagedCallersOnly]
static bool LessFunc (IntPtr oneptr, IntPtr twoptr)
{
if (oneptr == twoptr)
@@ -62,9 +56,11 @@ static bool LessFunc (IntPtr oneptr, IntPtr twoptr)
static void XamSetVTable ()
{
- vtableIComparable.opEqualFunc = EqFunc;
- vtableIComparable.opLessFunc = LessFunc;
- PISetVtable (ref vtableIComparable);
+ unsafe {
+ vtableIComparable.opEqualFunc = &EqFunc;
+ vtableIComparable.opLessFunc = &LessFunc;
+ PISetVtable (ref vtableIComparable);
+ }
}
public bool OpEquals (ISwiftEquatable other)
diff --git a/SwiftRuntimeLibrary/SwiftDotNetCapsule.cs b/SwiftRuntimeLibrary/SwiftDotNetCapsule.cs
index 6c0b01d6..6a143bc2 100644
--- a/SwiftRuntimeLibrary/SwiftDotNetCapsule.cs
+++ b/SwiftRuntimeLibrary/SwiftDotNetCapsule.cs
@@ -3,13 +3,14 @@
using System;
using System.Runtime.InteropServices;
-using Xamarin.iOS;
namespace SwiftRuntimeLibrary {
public sealed class SwiftDotNetCapsule : ISwiftObject {
static SwiftDotNetCapsule ()
{
- SetCapsuleOnDeinit (OnDeInit);
+ unsafe {
+ SetCapsuleOnDeinit (&OnDeInit);
+ }
}
internal class CapsuleTrackArgs : EventArgs {
@@ -23,7 +24,7 @@ public CapsuleTrackArgs (SwiftDotNetCapsule capsule)
internal static event EventHandler DeInitCalled;
internal static event EventHandler AllocCalled;
- [MonoPInvokeCallback (typeof (Action))]
+ [UnmanagedCallersOnly]
static void OnDeInit (IntPtr p)
{
if (SwiftObjectRegistry.Registry.Contains (p)) {
@@ -130,6 +131,6 @@ public IntPtr Data {
static extern void SetData (IntPtr inst, IntPtr p);
[DllImport (SwiftCore.kXamGlue, EntryPoint = XamGlueConstants.SwiftDotNetCapsule_SetCapsuleOnDeinit)]
- static extern void SetCapsuleOnDeinit ([MarshalAs (UnmanagedType.FunctionPtr)] Action callBack);
+ static extern unsafe void SetCapsuleOnDeinit (delegate *unmanaged callBack);
}
}
diff --git a/SwiftRuntimeLibrary/SwiftEquatableProxy.cs b/SwiftRuntimeLibrary/SwiftEquatableProxy.cs
index 5541272c..7ec3ed10 100644
--- a/SwiftRuntimeLibrary/SwiftEquatableProxy.cs
+++ b/SwiftRuntimeLibrary/SwiftEquatableProxy.cs
@@ -3,8 +3,6 @@
using System;
using System.Runtime.InteropServices;
-using SwiftRuntimeLibrary.SwiftMarshal;
-using Xamarin.iOS;
namespace SwiftRuntimeLibrary {
public class SwiftEquatableProxy : BaseProxy, ISwiftEquatable {
@@ -24,8 +22,7 @@ public SwiftEquatableProxy (ISwiftExistentialContainer container)
struct Equatable_xam_vtable {
public delegate bool Delfunc0 (IntPtr one, IntPtr two);
- [MarshalAs (UnmanagedType.FunctionPtr)]
- public Delfunc0 func0;
+ public unsafe delegate *unmanaged func0;
}
static Equatable_xam_vtable vtableIEquatable;
@@ -34,9 +31,7 @@ static SwiftEquatableProxy ()
XamSetVTable ();
}
-#if __IOS__
- [MonoPInvokeCallback(typeof(Equatable_xam_vtable.Delfunc0))]
-#endif
+ [UnmanagedCallersOnly]
static bool EqFunc (IntPtr oneptr, IntPtr twoptr)
{
if (oneptr == twoptr)
@@ -50,8 +45,10 @@ static bool EqFunc (IntPtr oneptr, IntPtr twoptr)
static void XamSetVTable ()
{
- vtableIEquatable.func0 = EqFunc;
- PISetVtable (ref vtableIEquatable);
+ unsafe {
+ vtableIEquatable.func0 = &EqFunc;
+ PISetVtable (ref vtableIEquatable);
+ }
}
public bool OpEquals (ISwiftEquatable other)
diff --git a/SwiftRuntimeLibrary/SwiftHashableProxy.cs b/SwiftRuntimeLibrary/SwiftHashableProxy.cs
index e9acb1af..ff158581 100644
--- a/SwiftRuntimeLibrary/SwiftHashableProxy.cs
+++ b/SwiftRuntimeLibrary/SwiftHashableProxy.cs
@@ -4,7 +4,6 @@
using System;
using System.Runtime.InteropServices;
using SwiftRuntimeLibrary.SwiftMarshal;
-using Xamarin.iOS;
namespace SwiftRuntimeLibrary {
public class SwiftHashableProxy : BaseProxy, ISwiftHashable {
@@ -24,8 +23,7 @@ public SwiftHashableProxy (ISwiftExistentialContainer container)
struct Hashable_xam_vtable {
public delegate nint Delfunc0 (IntPtr self);
- [MarshalAs (UnmanagedType.FunctionPtr)]
- public Delfunc0 func0;
+ public unsafe delegate* unmanaged func0;
}
static Hashable_xam_vtable vtableIHashable;
@@ -34,9 +32,7 @@ static SwiftHashableProxy ()
XamSetVTable ();
}
-#if __IOS__
- [MonoPInvokeCallback(typeof(Hashable_xam_vtable.Delfunc0))]
-#endif
+ [UnmanagedCallersOnly]
static nint HashFunc (IntPtr selfPtr)
{
var one = SwiftObjectRegistry.Registry.ProxyForEveryProtocolHandle (selfPtr);
@@ -45,8 +41,10 @@ static nint HashFunc (IntPtr selfPtr)
static void XamSetVTable ()
{
- vtableIHashable.func0 = HashFunc;
- PISetVtable (ref vtableIHashable);
+ unsafe {
+ vtableIHashable.func0 = &HashFunc;
+ PISetVtable (ref vtableIHashable);
+ }
}
public nint HashValue {
diff --git a/SwiftRuntimeLibrary/SwiftMarshal/StructMarshal.cs b/SwiftRuntimeLibrary/SwiftMarshal/StructMarshal.cs
index 30abbff4..28e38363 100644
--- a/SwiftRuntimeLibrary/SwiftMarshal/StructMarshal.cs
+++ b/SwiftRuntimeLibrary/SwiftMarshal/StructMarshal.cs
@@ -472,8 +472,10 @@ SwiftMetatype PrimitiveMetatype (Type t)
case TypeCode.Double:
return SwiftStandardMetatypes.Double;
default:
- if (t == typeof (IntPtr) || t == typeof (UIntPtr)) {
- return Metatypeof (typeof (OpaquePointer));
+ if (t == typeof (IntPtr)) {
+ return SwiftStandardMetatypes.Int;
+ } else if (t == typeof (UIntPtr)) {
+ return SwiftStandardMetatypes.UInt;
}
throw new SwiftRuntimeException ($"Illegal type code for type {t.Name}: {Type.GetTypeCode (t)}");
}
@@ -810,16 +812,31 @@ object MarshalDelegateToNet (IntPtr swiftSourceMemory, Type t, bool owns)
return delTuple.Item1;
// didn't find it - weird - but we can still handle that case. Let it fall through
}
- var visibleClosure = MakeVisibleClosureFromBlindClosure (blindClosure, argTypes, returnType);
throw new NotImplementedException ();
}
- SwiftClosureRepresentation MakeVisibleClosureFromBlindClosure (BlindSwiftClosureRepresentation blindClosure,
- Type [] argTypes, Type returnType)
+ IntPtr MarshalDelegateToSwift (Type t, Delegate del, IntPtr swiftDestinationMemory)
+ {
+ var mi = t.GetMethod ("Invoke");
+ var argTypes = DelegateParameterTypes (mi);
+ var returnType = mi.ReturnType;
+
+ var rep = BuildClosureRepresentation (del, argTypes, returnType);
+ var blindRep = BuildBlindClosure (rep, argTypes, returnType, swiftDestinationMemory);
+ Marshal.StructureToPtr (blindRep, swiftDestinationMemory, false);
+ return swiftDestinationMemory;
+ }
+
+ public unsafe BlindSwiftClosureRepresentation GetBlindSwiftClosureRepresentation (Type t, Delegate del)
{
- var delegateObj = MakeDelegateFromBlindClosure (blindClosure, argTypes, returnType);
- return new SwiftClosureRepresentation (delegateObj, blindClosure.Data);
+ byte* p = stackalloc byte [IntPtr.Size * 2];
+ var mi = t.GetMethod ("Invoke");
+ var argTypes = DelegateParameterTypes (mi);
+ var returnType = mi.ReturnType;
+
+ var rep = BuildClosureRepresentation (del, argTypes, returnType);
+ return BuildBlindClosure (rep, argTypes, returnType, new IntPtr (p));
}
public Delegate MakeDelegateFromBlindClosure (BlindSwiftClosureRepresentation blindClosure, Type [] argTypes, Type returnType, ClosureFlags flags = ClosureFlags.None)
@@ -849,30 +866,6 @@ public Delegate MakeDelegateFromBlindClosure (BlindSwiftClosureRepresentation bl
return (Delegate)genCall.Invoke (SwiftObjectRegistry.Registry, new object [] { blindClosure });
}
-
- IntPtr MarshalDelegateToSwift (Type t, Delegate del, IntPtr swiftDestinationMemory)
- {
- var mi = t.GetMethod ("Invoke");
- var argTypes = DelegateParameterTypes (mi);
- var returnType = mi.ReturnType;
-
- var rep = BuildClosureRepresentation (del, argTypes, returnType);
- var blindRep = BuildBlindClosure (rep, argTypes, returnType, swiftDestinationMemory);
- Marshal.StructureToPtr (blindRep, swiftDestinationMemory, false);
- return swiftDestinationMemory;
- }
-
- public unsafe BlindSwiftClosureRepresentation GetBlindSwiftClosureRepresentation (Type t, Delegate del)
- {
- byte* p = stackalloc byte [IntPtr.Size * 2];
- var mi = t.GetMethod ("Invoke");
- var argTypes = DelegateParameterTypes (mi);
- var returnType = mi.ReturnType;
-
- var rep = BuildClosureRepresentation (del, argTypes, returnType);
- return BuildBlindClosure (rep, argTypes, returnType, new IntPtr (p));
- }
-
BlindSwiftClosureRepresentation BuildBlindClosure (SwiftClosureRepresentation rep, Type [] argTypes, Type returnType, IntPtr p)
{
var argMetatypes = argTypes.Select (at => Metatypeof (at)).ToArray ();
@@ -1078,22 +1071,22 @@ BlindSwiftClosureRepresentation BuildBlindClosure (SwiftClosureRepresentation re
}
}
- SwiftClosureRepresentation BuildClosureRepresentation (Delegate del, Type [] argTypes, Type returnType)
+ unsafe SwiftClosureRepresentation BuildClosureRepresentation (Delegate del, Type [] argTypes, Type returnType)
{
if (returnType == null) { // Action
if (argTypes.Length == 0) {
- return SwiftObjectRegistry.Registry.SwiftClosureForDelegate (del, SwiftClosureRepresentation.ActionCallbackVoidVoid,
+ return SwiftObjectRegistry.Registry.SwiftClosureForDelegate (del, &SwiftClosureRepresentation.ActionCallbackVoidVoid,
argTypes);
} else {
- return SwiftObjectRegistry.Registry.SwiftClosureForDelegate (del, SwiftClosureRepresentation.ActionCallback,
+ return SwiftObjectRegistry.Registry.SwiftClosureForDelegate (del, &SwiftClosureRepresentation.ActionCallback,
argTypes);
}
} else {
if (argTypes.Length == 0) {
- return SwiftObjectRegistry.Registry.SwiftClosureForDelegate (del, SwiftClosureRepresentation.FuncCallbackVoid,
+ return SwiftObjectRegistry.Registry.SwiftClosureForDelegate (del, &SwiftClosureRepresentation.FuncCallbackVoid,
argTypes, returnType);
} else {
- return SwiftObjectRegistry.Registry.SwiftClosureForDelegate (del, SwiftClosureRepresentation.FuncCallback,
+ return SwiftObjectRegistry.Registry.SwiftClosureForDelegate (del, &SwiftClosureRepresentation.FuncCallback,
argTypes, returnType);
}
}
@@ -1853,7 +1846,8 @@ static unsafe nfloat ReadNfloat (IntPtr p)
static IntPtr MarshalScalarToSwift (Type fieldType, object value, IntPtr swiftDestinationMemory)
{
// see https://msdn.microsoft.com/en-us/library/system.type.isprimitive.aspx
- switch (Type.GetTypeCode (fieldType)) {
+ var typeCode = Type.GetTypeCode (fieldType);
+ switch (typeCode) {
case TypeCode.Boolean:
Write ((bool)value ? (byte)1 : (byte)0, swiftDestinationMemory);
break;
@@ -1893,8 +1887,10 @@ static IntPtr MarshalScalarToSwift (Type fieldType, object value, IntPtr swiftDe
default:
if (fieldType == typeof (IntPtr) || fieldType == typeof (UIntPtr)) {
Marshal.StructureToPtr (value, swiftDestinationMemory, false);
+ } else {
+ throw new SwiftRuntimeException ($"Illegal type code {Enum.GetName (typeof (TypeCode), typeCode)} for {value} (value Type: {value.GetType ().Name}, fieldType {fieldType.Name})");
}
- throw new SwiftRuntimeException ("Illegal type code " + Type.GetTypeCode (fieldType));
+ break;
}
return swiftDestinationMemory;
}
@@ -1968,12 +1964,7 @@ static unsafe void Write (ulong val, IntPtr p)
*((ulong*)p) = val;
}
- static unsafe void Write (IntPtr val, IntPtr p)
- {
- *((void**)p) = (void*)val;
- }
-
- static unsafe void Write (UIntPtr val, IntPtr p)
+ static unsafe void Write (void *val, IntPtr p)
{
*((void**)p) = (void*)val;
}
diff --git a/SwiftRuntimeLibrary/SwiftObjectRegistry.cs b/SwiftRuntimeLibrary/SwiftObjectRegistry.cs
index 70b4a33b..c7e626f4 100644
--- a/SwiftRuntimeLibrary/SwiftObjectRegistry.cs
+++ b/SwiftRuntimeLibrary/SwiftObjectRegistry.cs
@@ -431,7 +431,7 @@ object ExistingInterfaceImplementationForContainer (Type interfaceType, ISwiftEx
Dictionary> registeredClosures =
new Dictionary> ();
- public SwiftClosureRepresentation SwiftClosureForDelegate (Delegate d, Action action, Type [] argumentTypes)
+ public unsafe SwiftClosureRepresentation SwiftClosureForDelegate (Delegate d, delegate *unmanaged action, Type [] argumentTypes)
{
lock (registryLock) {
var capsule = new SwiftDotNetCapsule (IntPtr.Zero);
@@ -441,7 +441,7 @@ public SwiftClosureRepresentation SwiftClosureForDelegate (Delegate d, Action action, Type [] argumentTypes)
+ public unsafe SwiftClosureRepresentation SwiftClosureForDelegate (Delegate d, delegate *unmanaged action, Type [] argumentTypes)
{
lock (registryLock) {
var capsule = new SwiftDotNetCapsule (IntPtr.Zero);
@@ -451,7 +451,7 @@ public SwiftClosureRepresentation SwiftClosureForDelegate (Delegate d, Action action, Type [] argumentTypes, Type returnType)
+ public unsafe SwiftClosureRepresentation SwiftClosureForDelegate (Delegate d, delegate *unmanaged action, Type [] argumentTypes, Type returnType)
{
lock (registryLock) {
var capsule = new SwiftDotNetCapsule (IntPtr.Zero);
@@ -470,7 +470,7 @@ public SwiftClosureRepresentation SwiftClosureForDelegate (Delegate d, Action action, Type [] argumentTypes, Type returnType)
+ public unsafe SwiftClosureRepresentation SwiftClosureForDelegate (Delegate d, delegate *unmanaged action, Type [] argumentTypes, Type returnType)
{
lock (registryLock) {
var capsule = new SwiftDotNetCapsule (IntPtr.Zero);
diff --git a/SwiftRuntimeLibrary/SwiftRuntimeLibrary.csproj b/SwiftRuntimeLibrary/SwiftRuntimeLibrary.csproj
index 01cabe1c..8c6ed3d7 100644
--- a/SwiftRuntimeLibrary/SwiftRuntimeLibrary.csproj
+++ b/SwiftRuntimeLibrary/SwiftRuntimeLibrary.csproj
@@ -1,94 +1,25 @@
-
-
+
- Debug
- AnyCPU
- {B7E6CF5A-B836-41CF-988C-A83607AF5445}
+ net7.0
Library
- SwiftRuntimeLibrary
- SwiftRuntimeLibrary
- v4.5
+ false
- true
- full
- false
bin\Debug
DEBUG;TOM_SWIFTY;SWIFT;SWIFT4
- prompt
- 4
false
--swift-bin-path /Users/steveh/xamroot/maccore/tools/apple/build/Xcode-DebugAssert/swift-macosx-x86_64/Debug/bin/ --swift-lib-path /Users/steveh/xamroot/maccore/tools/apple/build/Xcode-DebugAssert/swift-macosx-x86_64/Debug/lib -C /Users/steveh/hacking/unithelp -o /Users/steveh/hacking/unithelp/nonewrap None1
true
-
- true
+
+
bin\Release
TOM_SWIFTY;SWIFT;SWIFT4
- prompt
- 4
false
true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
XamGlueConstants.cs
@@ -98,36 +29,6 @@
SymbolicatorInfoAttribute.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -138,4 +39,4 @@
-
\ No newline at end of file
+
diff --git a/devops/automation/build.sh b/devops/automation/build.sh
index 801378d7..2943233a 100755
--- a/devops/automation/build.sh
+++ b/devops/automation/build.sh
@@ -8,14 +8,14 @@ fi
cd $BTFS_TOP
WORKSPACE=$(pwd)
-nuget restore tom-swifty.sln
+dotnet restore tom-swifty.sln --packages packages
cd "$WORKSPACE/plist-swifty"
-msbuild
+dotnet build
cd "$WORKSPACE/type-o-matic"
-msbuild
+dotnet build
cd "$WORKSPACE/swiftglue"
make generate-swift-bindings
make all -j8
cd "$WORKSPACE"
-msbuild tom-swifty.sln
+dotnet build tom-swifty.sln
diff --git a/leaktest/leaktest.csproj b/leaktest/leaktest.csproj
index 7e03d53d..2bcbb5c1 100644
--- a/leaktest/leaktest.csproj
+++ b/leaktest/leaktest.csproj
@@ -1,59 +1,37 @@
-
-
-
- Debug
- x86
- {33D1E7E3-A123-43F0-B047-163C6E75D3BF}
- Exe
- leaktest
- leaktest
- v4.5
-
-
- true
- full
- false
- bin\Debug
- DEBUG;
- prompt
- 4
- true
- x86
-
-
- true
- bin\Release
- prompt
- 4
- true
- x86
-
-
- Project
- test-cli
- ..\objc-cli
- false
-
-
-
-
-
-
-
-
-
- PreserveNewest
-
-
-
-
-
-
- PreserveNewest
-
-
-
-
-
-
+
+
+ net7.0
+ x86
+ Exe
+ false
+ x86;AnyCPU
+
+
+ bin\Debug
+ DEBUG;
+ true
+
+
+ bin\Release
+ true
+
+
+ Project
+ test-cli
+ ..\objc-cli
+ false
+
+
+
+ PreserveNewest
+
+
+
+
+ PreserveNewest
+
+
+
+
+
\ No newline at end of file
diff --git a/plist-swifty/Properties/AssemblyInfo.cs b/plist-swifty/Properties/AssemblyInfo.cs
index f194fd61..32bfef76 100644
--- a/plist-swifty/Properties/AssemblyInfo.cs
+++ b/plist-swifty/Properties/AssemblyInfo.cs
@@ -20,7 +20,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
diff --git a/plist-swifty/packages.config b/plist-swifty/packages.config
deleted file mode 100644
index 2deaf39e..00000000
--- a/plist-swifty/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/plist-swifty/plist-swifty.csproj b/plist-swifty/plist-swifty.csproj
index 0ce5fdf6..4596351a 100644
--- a/plist-swifty/plist-swifty.csproj
+++ b/plist-swifty/plist-swifty.csproj
@@ -1,75 +1,51 @@
-
-
-
- Debug
- x86
- {74C4FF75-6D3A-4F58-8D8D-562610E1A40D}
- Exe
- plistswifty
- plist-swifty
- v4.6.1
-
-
- true
- full
- false
- bin\Debug
- DEBUG;
- prompt
- 4
- true
- x86
-
-
- true
- bin\Release
- prompt
- 4
- true
- x86
-
-
-
-
-
-
- ..\packages\Mono.Options.5.3.0.1\lib\net4-client\Mono.Options.dll
- True
-
-
-
-
-
-
-
-
-
- InfoPList.cs
-
-
- MachOHelpers.cs
-
-
- PLItemEnums.cs
-
-
- PLItems.cs
-
-
- ExecAndCollect.cs
-
-
- MachOHawley.cs
-
-
- Enums.cs
-
-
- CompilationTarget.cs
-
-
-
-
-
-
+
+
+ net7.0
+ x86
+ Exe
+ plistswifty
+ false
+ x86;AnyCPU
+
+
+ bin\Debug
+ DEBUG;
+ true
+
+
+ bin\Release
+ true
+
+
+
+
+
+
+ InfoPList.cs
+
+
+ MachOHelpers.cs
+
+
+ PLItemEnums.cs
+
+
+ PLItems.cs
+
+
+ ExecAndCollect.cs
+
+
+ MachOHawley.cs
+
+
+ Enums.cs
+
+
+ CompilationTarget.cs
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/piglatin/PigLatin/PigLatin.sln b/samples/piglatin/PigLatin/PigLatin.sln
index ff7dc3d0..a2f69018 100644
--- a/samples/piglatin/PigLatin/PigLatin.sln
+++ b/samples/piglatin/PigLatin/PigLatin.sln
@@ -1,31 +1,31 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.809.9
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PigLatin", "PigLatin\PigLatin.csproj", "{3EFD26FE-5B97-432C-915F-297558BB8160}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|iPhoneSimulator = Debug|iPhoneSimulator
- Release|iPhoneSimulator = Release|iPhoneSimulator
- Debug|iPhone = Debug|iPhone
- Release|iPhone = Release|iPhone
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {3EFD26FE-5B97-432C-915F-297558BB8160}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
- {3EFD26FE-5B97-432C-915F-297558BB8160}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
- {3EFD26FE-5B97-432C-915F-297558BB8160}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
- {3EFD26FE-5B97-432C-915F-297558BB8160}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
- {3EFD26FE-5B97-432C-915F-297558BB8160}.Debug|iPhone.ActiveCfg = Debug|iPhone
- {3EFD26FE-5B97-432C-915F-297558BB8160}.Debug|iPhone.Build.0 = Debug|iPhone
- {3EFD26FE-5B97-432C-915F-297558BB8160}.Release|iPhone.ActiveCfg = Release|iPhone
- {3EFD26FE-5B97-432C-915F-297558BB8160}.Release|iPhone.Build.0 = Release|iPhone
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {4A663ADA-593F-49C4-BD44-6EC8A170D30E}
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.809.9
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PigLatin", "PigLatin\PigLatin.csproj", "{3EFD26FE-5B97-432C-915F-297558BB8160}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|iPhoneSimulator = Debug|iPhoneSimulator
+ Release|iPhoneSimulator = Release|iPhoneSimulator
+ Debug|iPhone = Debug|iPhone
+ Release|iPhone = Release|iPhone
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {3EFD26FE-5B97-432C-915F-297558BB8160}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
+ {3EFD26FE-5B97-432C-915F-297558BB8160}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
+ {3EFD26FE-5B97-432C-915F-297558BB8160}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
+ {3EFD26FE-5B97-432C-915F-297558BB8160}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
+ {3EFD26FE-5B97-432C-915F-297558BB8160}.Debug|iPhone.ActiveCfg = Debug|iPhone
+ {3EFD26FE-5B97-432C-915F-297558BB8160}.Debug|iPhone.Build.0 = Debug|iPhone
+ {3EFD26FE-5B97-432C-915F-297558BB8160}.Release|iPhone.ActiveCfg = Release|iPhone
+ {3EFD26FE-5B97-432C-915F-297558BB8160}.Release|iPhone.Build.0 = Release|iPhone
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {4A663ADA-593F-49C4-BD44-6EC8A170D30E}
+ EndGlobalSection
+EndGlobal
diff --git a/samples/piglatin/PigLatin/PigLatin/PigLatin.csproj b/samples/piglatin/PigLatin/PigLatin/PigLatin.csproj
index 50c8f5c7..0dfba497 100644
--- a/samples/piglatin/PigLatin/PigLatin/PigLatin.csproj
+++ b/samples/piglatin/PigLatin/PigLatin/PigLatin.csproj
@@ -1,171 +1,70 @@
-
-
-
- Debug
- iPhoneSimulator
- {3EFD26FE-5B97-432C-915F-297558BB8160}
- {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- {edc1b0fa-90cd-4038-8fad-98fe74adb368}
- Exe
- PigLatin
- PigLatin
- Resources
- true
- NSUrlSessionHandler
- PackageReference
- automatic
-
-
- true
- full
- false
- bin\iPhoneSimulator\Debug
- DEBUG
- prompt
- 4
- x86_64
- None
- true
-
- true
-
-
- none
- true
- bin\iPhoneSimulator\Release
- prompt
- 4
- None
- x86_64
- true
-
-
- true
- full
- false
- bin\iPhone\Debug
- DEBUG
- prompt
- 4
- ARM64
- Entitlements.plist
- iPhone Developer
- true
- SdkOnly
- true
-
-
- none
- true
- bin\iPhone\Release
- prompt
- 4
- Entitlements.plist
- ARM64
- iPhone Developer
- SdkOnly
- true
-
-
-
-
-
-
-
-
-
- ..\..\..\..\lib\SwiftInterop\SwiftRuntimeLibrary.iOS.dll
-
-
-
-
-
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Framework
- False
-
-
- Framework
- False
-
-
- Framework
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ Exe
+ Resources
+ true
+ automatic
+ net7.0-ios
+ True
+
+
+ None
+ true
+
+
+ true
+ iossimulator-x64
+
+
+ None
+ true
+ iossimulator-x64
+
+
+ Entitlements.plist
+ iPhone Developer
+ true
+ SdkOnly
+ true
+ ios-arm64
+
+
+ Entitlements.plist
+ iPhone Developer
+ SdkOnly
+ true
+ ios-arm64
+
+
+
+ ..\..\..\..\lib\SwiftInterop\SwiftRuntimeLibrary.iOS.dll
+
+
+
+
+ Framework
+ False
+
+
+ Framework
+ False
+
+
+ Framework
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/swift-copy-libs/packages.config b/swift-copy-libs/packages.config
deleted file mode 100644
index 452b1af6..00000000
--- a/swift-copy-libs/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/swift-copy-libs/swift-copy-libs.csproj b/swift-copy-libs/swift-copy-libs.csproj
index 11fda45b..711e55c2 100644
--- a/swift-copy-libs/swift-copy-libs.csproj
+++ b/swift-copy-libs/swift-copy-libs.csproj
@@ -1,47 +1,19 @@
-
-
-
- Debug
- x86
- {11F5D3B2-AC30-47A9-A4FF-998835C5CF9D}
- Exe
- swiftcopylibs
- swift-copy-libs
- v4.7
-
-
- true
- full
- false
- bin\Debug
- DEBUG;
- prompt
- 4
- true
- x86
-
-
- true
- bin\Release
- prompt
- 4
- true
- x86
-
-
-
-
- ..\packages\Mono.Options.5.3.0.1\lib\net4-client\Mono.Options.dll
-
-
-
-
-
- MachOHawley.cs
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+ net7.0
+ x86
+ Exe
+ swiftcopylibs
+ false
+ x86;AnyCPU
+ true
+
+
+
+ MachOHawley.cs
+
+
+
+
+
+
diff --git a/tests/tom-swifty-test/CommandLineTests/OutputTests.cs b/tests/tom-swifty-test/CommandLineTests/OutputTests.cs
index 62772d0d..308b28cd 100644
--- a/tests/tom-swifty-test/CommandLineTests/OutputTests.cs
+++ b/tests/tom-swifty-test/CommandLineTests/OutputTests.cs
@@ -27,7 +27,7 @@ public void TestWarningOutput ()
var swiftCode = "public class Foo {\npublic var x:Int = 3\n }";
var output = RunBindingToolsForSwift (swiftCode, "TestWarningOutput");
var lines = output.Split ('\n');
- CollectionAssert.Contains (lines, "warning SM4018: entry _$s11OutputTests3FooC1xSivMTq uses an unsupported swift feature, skipping.");
+ Assert.That (lines, Has.Member ("warning SM4018: entry _$s11OutputTests3FooC1xSivMTq uses an unsupported swift feature, skipping."));
}
string RunBindingToolsForSwift (string swiftCode, string testName = null)
diff --git a/tests/tom-swifty-test/CommandLineTests/SwiftyOptionsTests.cs b/tests/tom-swifty-test/CommandLineTests/SwiftyOptionsTests.cs
index c8ea8b5b..e28d5ab2 100644
--- a/tests/tom-swifty-test/CommandLineTests/SwiftyOptionsTests.cs
+++ b/tests/tom-swifty-test/CommandLineTests/SwiftyOptionsTests.cs
@@ -5,6 +5,7 @@
using System.Collections;
using System.IO;
using NUnit.Framework;
+using NUnit.Framework.Legacy;
using SwiftReflector.IOUtils;
using tomswifty;
@@ -734,65 +735,65 @@ public void TestCommandLineParsing (string[] args, SwiftyOptions expectedOptions
{
var options = new SwiftyOptions ();
var extra = options.ParseCommandLine (args);
- Assert.AreEqual (0, extra.Count, "Extra parameters");
+ ClassicAssert.AreEqual (0, extra.Count, "Extra parameters");
var d = Path.Combine (AppDomain.CurrentDomain.BaseDirectory, "first");
// compare the values
- Assert.AreEqual (expectedOptions.RetainXmlReflection, options.RetainXmlReflection, $"{testMessage} - {nameof(SwiftyOptions.RetainXmlReflection)}");
- Assert.AreEqual (expectedOptions.RetainSwiftWrappingCode, options.RetainSwiftWrappingCode, $"{testMessage} - {nameof(SwiftyOptions.RetainSwiftWrappingCode)}");
- Assert.AreEqual (expectedOptions.PrintStackTrace, options.PrintStackTrace, $"{testMessage} - {nameof(SwiftyOptions.PrintStackTrace)}");
- Assert.AreEqual (expectedOptions.ModuleName, options.ModuleName, $"{testMessage} - {nameof(SwiftyOptions.ModuleName)}");
- Assert.AreEqual (expectedOptions.WrappingModuleName, options.WrappingModuleName, $"{testMessage} - {nameof(SwiftyOptions.WrappingModuleName)}");
- Assert.AreEqual (expectedOptions.GlobalClassName, options.GlobalClassName, $"{testMessage} - {nameof(SwiftyOptions.GlobalClassName)}");
- Assert.AreEqual (expectedOptions.TargetPlatformIs64Bit, options.TargetPlatformIs64Bit, $"{testMessage} - {nameof(SwiftyOptions.TargetPlatformIs64Bit)}");
- Assert.AreEqual (expectedOptions.PrintHelp, options.PrintHelp, $"{testMessage} - {nameof(SwiftyOptions.PrintHelp)}");
- Assert.AreEqual (expectedOptions.Demangle, options.Demangle, $"{testMessage} - {nameof(SwiftyOptions.Demangle)}");
- Assert.AreEqual (expectedOptions.PInvokeClassPrefix, options.PInvokeClassPrefix, $"{testMessage} - {nameof(SwiftyOptions.PInvokeClassPrefix)}");
- Assert.AreEqual (expectedOptions.PrintStackTrace, options.PrintStackTrace, $"{testMessage} - {nameof(SwiftyOptions.PrintStackTrace)}");
- Assert.AreEqual (expectedOptions.Verbose, options.Verbose, $"{testMessage} - {nameof(SwiftyOptions.Verbose)}");
- Assert.AreEqual (expectedOptions.PrintVersion, options.PrintVersion, $"{testMessage} - {nameof(SwiftyOptions.PrintVersion)}");
+ ClassicAssert.AreEqual (expectedOptions.RetainXmlReflection, options.RetainXmlReflection, $"{testMessage} - {nameof(SwiftyOptions.RetainXmlReflection)}");
+ ClassicAssert.AreEqual (expectedOptions.RetainSwiftWrappingCode, options.RetainSwiftWrappingCode, $"{testMessage} - {nameof(SwiftyOptions.RetainSwiftWrappingCode)}");
+ ClassicAssert.AreEqual (expectedOptions.PrintStackTrace, options.PrintStackTrace, $"{testMessage} - {nameof(SwiftyOptions.PrintStackTrace)}");
+ ClassicAssert.AreEqual (expectedOptions.ModuleName, options.ModuleName, $"{testMessage} - {nameof(SwiftyOptions.ModuleName)}");
+ ClassicAssert.AreEqual (expectedOptions.WrappingModuleName, options.WrappingModuleName, $"{testMessage} - {nameof(SwiftyOptions.WrappingModuleName)}");
+ ClassicAssert.AreEqual (expectedOptions.GlobalClassName, options.GlobalClassName, $"{testMessage} - {nameof(SwiftyOptions.GlobalClassName)}");
+ ClassicAssert.AreEqual (expectedOptions.TargetPlatformIs64Bit, options.TargetPlatformIs64Bit, $"{testMessage} - {nameof(SwiftyOptions.TargetPlatformIs64Bit)}");
+ ClassicAssert.AreEqual (expectedOptions.PrintHelp, options.PrintHelp, $"{testMessage} - {nameof(SwiftyOptions.PrintHelp)}");
+ ClassicAssert.AreEqual (expectedOptions.Demangle, options.Demangle, $"{testMessage} - {nameof(SwiftyOptions.Demangle)}");
+ ClassicAssert.AreEqual (expectedOptions.PInvokeClassPrefix, options.PInvokeClassPrefix, $"{testMessage} - {nameof(SwiftyOptions.PInvokeClassPrefix)}");
+ ClassicAssert.AreEqual (expectedOptions.PrintStackTrace, options.PrintStackTrace, $"{testMessage} - {nameof(SwiftyOptions.PrintStackTrace)}");
+ ClassicAssert.AreEqual (expectedOptions.Verbose, options.Verbose, $"{testMessage} - {nameof(SwiftyOptions.Verbose)}");
+ ClassicAssert.AreEqual (expectedOptions.PrintVersion, options.PrintVersion, $"{testMessage} - {nameof(SwiftyOptions.PrintVersion)}");
- Assert.AreEqual (expectedOptions.PrintHelp, options.PrintHelp, $"{testMessage} - {nameof(SwiftyOptions.PrintHelp)}");
+ ClassicAssert.AreEqual (expectedOptions.PrintHelp, options.PrintHelp, $"{testMessage} - {nameof(SwiftyOptions.PrintHelp)}");
if (expectedOptions.SwiftGluePath != null)
- Assert.AreEqual (expectedOptions.SwiftGluePath, options.SwiftGluePath,
+ ClassicAssert.AreEqual (expectedOptions.SwiftGluePath, options.SwiftGluePath,
$"{testMessage} - {nameof (SwiftyOptions.SwiftGluePath)}");
else
- Assert.Null (options.SwiftGluePath, $"{testMessage} - {nameof (SwiftyOptions.SwiftGluePath)}");
+ ClassicAssert.Null (options.SwiftGluePath, $"{testMessage} - {nameof (SwiftyOptions.SwiftGluePath)}");
if (expectedOptions.SwiftLibPath != null)
- Assert.AreEqual (expectedOptions.SwiftLibPath, options.SwiftLibPath,
+ ClassicAssert.AreEqual (expectedOptions.SwiftLibPath, options.SwiftLibPath,
$"{testMessage} - {nameof (SwiftyOptions.SwiftLibPath)}");
else
- Assert.Null (options.SwiftLibPath, $"{testMessage} - {nameof (SwiftyOptions.SwiftLibPath)}");
+ ClassicAssert.Null (options.SwiftLibPath, $"{testMessage} - {nameof (SwiftyOptions.SwiftLibPath)}");
if (expectedOptions.SwiftBinPath != null)
- Assert.AreEqual (expectedOptions.SwiftBinPath, options.SwiftBinPath,
+ ClassicAssert.AreEqual (expectedOptions.SwiftBinPath, options.SwiftBinPath,
$"{testMessage} - {nameof (SwiftyOptions.SwiftBinPath)}");
else
- Assert.Null (options.SwiftBinPath, $"{testMessage} - {nameof (SwiftyOptions.SwiftBinPath)}");
+ ClassicAssert.Null (options.SwiftBinPath, $"{testMessage} - {nameof (SwiftyOptions.SwiftBinPath)}");
if (expectedOptions.OutputDirectory != null)
- Assert.AreEqual (expectedOptions.OutputDirectory, options.OutputDirectory,
+ ClassicAssert.AreEqual (expectedOptions.OutputDirectory, options.OutputDirectory,
$"{testMessage} - {nameof (SwiftyOptions.OutputDirectory)}");
else
- Assert.Null (options.OutputDirectory, $"{testMessage} - {nameof (SwiftyOptions.OutputDirectory)}");
+ ClassicAssert.Null (options.OutputDirectory, $"{testMessage} - {nameof (SwiftyOptions.OutputDirectory)}");
// path collections
- Assert.AreEqual (expectedOptions.DylibPaths.Count, options.DylibPaths.Count, $"{testMessage} - {nameof(SwiftyOptions.DylibPaths)}.Count");
+ ClassicAssert.AreEqual (expectedOptions.DylibPaths.Count, options.DylibPaths.Count, $"{testMessage} - {nameof(SwiftyOptions.DylibPaths)}.Count");
for (var i = 0; i < expectedOptions.DylibPaths.Count; i++)
{
- Assert.AreEqual (expectedOptions.DylibPaths[i], options.DylibPaths[i],
+ ClassicAssert.AreEqual (expectedOptions.DylibPaths[i], options.DylibPaths[i],
$"{testMessage} - {nameof (SwiftyOptions.DylibPaths)}[{i}]");
}
- Assert.AreEqual (expectedOptions.ModulePaths.Count, options.ModulePaths.Count, $"{testMessage} - {nameof(SwiftyOptions.ModulePaths)}.Count");
+ ClassicAssert.AreEqual (expectedOptions.ModulePaths.Count, options.ModulePaths.Count, $"{testMessage} - {nameof(SwiftyOptions.ModulePaths)}.Count");
for (var i = 0; i < expectedOptions.ModulePaths.Count; i++)
{
- Assert.AreEqual (expectedOptions.ModulePaths[i], options.ModulePaths[i],
+ ClassicAssert.AreEqual (expectedOptions.ModulePaths[i], options.ModulePaths[i],
$"{testMessage} - {nameof (SwiftyOptions.ModulePaths)}[{i}]");
}
diff --git a/tests/tom-swifty-test/Compiler.cs b/tests/tom-swifty-test/Compiler.cs
index be409a80..9647137f 100644
--- a/tests/tom-swifty-test/Compiler.cs
+++ b/tests/tom-swifty-test/Compiler.cs
@@ -13,6 +13,8 @@
using System.Collections.Specialized;
using System.Collections.Generic;
using Xamarin.Utils;
+using NUnit.Framework.Legacy;
+using System.Linq;
namespace tomwiftytest {
@@ -28,9 +30,11 @@ public enum XCodeCompiler {
public class Compiler {
// Enviroment var that can be used to test binding-tools-for-swift from a package
static string SOM_PATH = Environment.GetEnvironmentVariable ("SOM_PATH");
+ public static string kframeWorkVersion = "7.0";
+ public static string kswiftVersion = "5.5";
#if DEBUG
- public const string kSwiftRuntimeGlueDirectoryRel = "../../../../swiftglue/bin/Debug/mac/FinalProduct/XamGlue.framework";
- public const string kSwiftRuntimeSourceDirectoryRel = "../../../../swiftglue/";
+ public const string kSwiftRuntimeGlueDirectoryRel = "../../../../../swiftglue/bin/Debug/mac/FinalProduct/XamGlue.framework";
+ public const string kSwiftRuntimeSourceDirectoryRel = "../../../../../swiftglue/";
#endif
public static string kSwiftDeviceTestRoot = PosixHelpers.RealPath (Path.Combine (GetTestDirectory (), "../../devicetests"));
public static string kLeakCheckBinary = PosixHelpers.RealPath (Path.Combine (GetTestDirectory (), "..", "..", "..", "..", "leaktest", "bin", "Debug", "leaktest"));
@@ -38,7 +42,7 @@ public class Compiler {
public static string kXamGlueSourceDirectory = PosixHelpers.RealPath (SOM_PATH ?? Path.Combine (GetTestDirectory (), kSwiftRuntimeSourceDirectoryRel));
static string kSystemBin = "/usr/bin/";
- static string kSystemLib = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/macosx";
+ public const string kSystemLib = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/macosx";
[ThreadStatic]
static SwiftCompilerLocation systemCompilerLocation;
@@ -51,14 +55,16 @@ public static SwiftCompilerLocation SystemCompilerLocation {
}
- public static List kTypeDatabases = new List { PosixHelpers.RealPath (SOM_PATH is null ? Path.Combine (GetTestDirectory (), "../../../../bindings") : FindPathFromEnvVariable ("bindings")) };
+ public static List kTypeDatabases = new List { PosixHelpers.RealPath (SOM_PATH is null ? Path.Combine (GetTestDirectory (), "../../../../../bindings") : FindPathFromEnvVariable ("bindings")) };
public const string kMono64Path = "/Library/Frameworks/Mono.framework/Versions/Current/bin/mono";
public static string kTestRoot = PosixHelpers.RealPath (GetTestDirectory ());
#if DEBUG
- public static string kTomSwiftyPath = PosixHelpers.RealPath (SOM_PATH is null ? Path.Combine (GetTestDirectory (), "../../../../tom-swifty/bin/Debug/tom-swifty.exe") : FindPathFromEnvVariable ("lib/binding-tools-for-swift/tom-swifty.exe"));
+ public static string kTomSwiftyPath = PosixHelpers.RealPath (SOM_PATH is null ? Path.Combine (GetTestDirectory (), "../../../../../tom-swifty/bin/Debug/tom-swifty.exe") : FindPathFromEnvVariable ("lib/binding-tools-for-swift/tom-swifty.exe"));
#else
public static string kTomSwiftyPath = PosixHelpers.RealPath (SOM_PATH is null ? Path.Combine (GetTestDirectory (), "../../../../tom-swifty/bin/Release/tom-swifty.exe") : FindPathFromEnvVariable ("lib/binding-tools-for-swift/tom-swifty.exe"));
#endif
+ public static string kMacProjPath = PosixHelpers.RealPath (Path.Combine (GetTestDirectory (), "../../../../../SwiftRuntimeLibrary.Mac/SwiftRuntimeLibrary.Mac.csproj"));
+ public static string kiOSProjPath = PosixHelpers.RealPath (Path.Combine (GetTestDirectory (), "../../../../../SwiftRuntimeLibrary.iOS/SwiftRuntimeLibrary.iOS.csproj"));
static string [] compilers = new string [] {
"clang -x c", "clang -x c++", "clang -x objective-c", "swiftc", "mcs", "mcs", "swiftc", "swift"
};
@@ -152,7 +158,117 @@ public static Stream CompileUsing (string xcrun, XCodeCompiler compiler, string
public static string CSCompile (string workingDirectory, string [] sourceFiles, string outputFile, string extraOptions = "", PlatformName platform = PlatformName.None)
{
- return ExecAndCollect.Run ("/Library/Frameworks/Mono.framework/Versions/Current/bin/csc", BuildCSCompileArgs (sourceFiles, outputFile, extraOptions, platform), workingDirectory: workingDirectory ?? "");
+ if (platform != PlatformName.None) {
+ return PlatformBuild (workingDirectory, outputFile, platform);
+ } else {
+ CreateRuntimeConfigJson (workingDirectory, outputFile);
+ var compilerArgs = BuildCSCompileArgs (sourceFiles, outputFile, extraOptions, platform);
+ // ShowAllFiles (sourceFiles);
+ return ExecAndCollect.Run ("/usr/local/share/dotnet/dotnet", $"exec {GetDotnetCSCompiler ()} {compilerArgs}", workingDirectory: workingDirectory ?? "");
+ }
+ }
+
+ static string PlatformBuild (string workingDirectory, string outputfile, PlatformName platform)
+ {
+ // what happens here:
+ // make a new dotnet project for the specified platform (dotnet new ...)
+ // add a reference to the platform csproj to get runtime
+ // build the resulting project
+
+ var sb = new StringBuilder ();
+ var name = Path.GetFileNameWithoutExtension (outputfile);
+ var projectDirectory = Path.Combine (workingDirectory, name);
+ var dotnetPlatform = PlatformNameToDotnetPlatform (platform);
+ var result = ExecAndCollect.Run ("/usr/local/share/dotnet/dotnet", $"new {dotnetPlatform} --name {name}", workingDirectory);
+ sb.Append (result);
+ RemoveExistingCSFiles (projectDirectory);
+ CopySourceCSFiles (workingDirectory, projectDirectory);
+ var projectReference = PlatformNameToPlatformProject (platform);
+ if (!File.Exists (projectReference)) {
+ throw new Exception ("Unable to find project: " + projectReference);
+ }
+
+ // copy xamglue, project libraries and swiftlibraries to somewhere useful
+ // Maybe MonoBundle or make a Frameworks directory as well.
+
+ result = ExecAndCollect.Run ("/usr/local/share/dotnet/dotnet", $"add reference {projectReference}", projectDirectory);
+ sb.Append (result);
+ result = ExecAndCollect.Run ("/usr/local/share/dotnet/dotnet", "build", projectDirectory);
+ sb.Append (result);
+ result = sb.ToString ();
+
+ Console.WriteLine ("build output");
+ Console.WriteLine (result);
+
+ return result;
+ }
+
+ static void RemoveExistingCSFiles (string directory)
+ {
+ var files = Directory.GetFiles (directory, "*.cs");
+ foreach (var file in files) {
+ File.Delete (file);
+ }
+ }
+
+ static void CopySourceCSFiles (string source, string dest)
+ {
+ var files = Directory.GetFiles (source, "*.cs");
+ foreach (var file in files) {
+ File.Copy (file, Path.Combine (dest, Path.GetFileName (file)));
+ }
+ }
+
+ static string PlatformNameToPlatformProject (PlatformName platform)
+ {
+ switch (platform)
+ {
+ case PlatformName.macOS:
+ return kMacProjPath;
+ case PlatformName.iOS:
+ return kiOSProjPath;
+ default:
+ throw new ArgumentOutOfRangeException (nameof (platform), $"unknown platform {platform}");
+ }
+ }
+
+ static string PlatformNameToDotnetPlatform (PlatformName platform)
+ {
+ switch (platform) {
+ case PlatformName.macOS:
+ return "macos";
+ case PlatformName.iOS:
+ return "ios";
+ case PlatformName.tvOS:
+ return "tvos";
+ case PlatformName.watchOS:
+ return "watchos";
+ default:
+ throw new ArgumentOutOfRangeException (nameof (platform), $"unknown platform {platform}");
+ }
+ }
+
+ static void CreateRuntimeConfigJson (string workingDirectory, string outputFile)
+ {
+ var fileName = Path.ChangeExtension (outputFile, ".runtimeconfig.json");
+ var fullPath = Path.Combine (workingDirectory ?? "", fileName);
+ using var file = new StreamWriter (fullPath, false);
+ file.WriteLine ($"{{\n \"runtimeOptions\": {{\n \"tfm\": \"net{kframeWorkVersion}\",\n \"framework\": {{\n \"name\": \"Microsoft.NETCore.App\",\n \"version\": \"{kframeWorkVersion}.0\"\n }}\n }}\n}}");
+ }
+
+ static void ShowAllFiles (string [] sourceFiles)
+ {
+ // useful for debugging
+ foreach (var file in sourceFiles)
+ ShowFile (file);
+ }
+
+ static void ShowFile (string file)
+ {
+ Console.WriteLine ($"-------- {file} --------");
+ using var reader = new StreamReader (file);
+ var text = reader.ReadToEnd ();
+ Console.WriteLine (text);
}
static string BuildCSCompileArgs (string [] sourceFiles, string outputFile, string extraOptions, PlatformName platform = PlatformName.None)
@@ -180,8 +296,14 @@ static string BuildCSCompileArgs (string [] sourceFiles, string outputFile, stri
sb.Append ($"-r:Xamarin.iOS.dll ");
break;
case PlatformName.None:
+ var referenceAssemblyDir = GetReferenceAssemblyLocation ();
sb.Append ($"-lib:{ConstructorTests.kSwiftRuntimeOutputDirectory} ");
sb.Append ($"-r:{ConstructorTests.kSwiftRuntimeLibrary}.dll ");
+ sb.Append ($"-r:{Path.Combine (referenceAssemblyDir, "System.dll")} ");
+ sb.Append ($"-r:{Path.Combine (referenceAssemblyDir, "System.Console.dll")} ");
+ sb.Append ($"-r:{Path.Combine (referenceAssemblyDir, "System.Runtime.dll")} ");
+ sb.Append ($"-r:{Path.Combine (referenceAssemblyDir, "System.Runtime.InteropServices.dll")} ");
+ sb.Append ($"-r:{Path.Combine (referenceAssemblyDir, "mscorlib.dll")} ");
break;
default:
throw new NotImplementedException (platform.ToString ());
@@ -257,20 +379,20 @@ public void HelloWorldC ()
using (Stream ostm = CompileStringUsing (null, XCodeCompiler.C,
kHelloC,
null)) {
- Assert.IsNotNull (ostm);
- Assert.IsTrue (ostm.Length > 0);
+ ClassicAssert.IsNotNull (ostm);
+ ClassicAssert.IsTrue (ostm.Length > 0);
}
}
[Test]
public void CSyntaxError ()
{
- Assert.Throws (() => {
+ ClassicAssert.Throws (() => {
using (Stream ostm = CompileStringUsing (null, XCodeCompiler.C,
"thisisnotc",
null)) {
- Assert.IsNotNull (ostm);
- Assert.IsTrue (ostm.Length > 0);
+ ClassicAssert.IsNotNull (ostm);
+ ClassicAssert.IsTrue (ostm.Length > 0);
}
});
}
@@ -281,8 +403,8 @@ public void HelloWorldCpp ()
using (Stream ostm = CompileStringUsing (null, XCodeCompiler.Cpp,
kHelloCpp,
null)) {
- Assert.IsNotNull (ostm);
- Assert.IsTrue (ostm.Length > 0);
+ ClassicAssert.IsNotNull (ostm);
+ ClassicAssert.IsTrue (ostm.Length > 0);
}
}
@@ -290,12 +412,12 @@ public void HelloWorldCpp ()
[Test]
public void CppSyntaxError ()
{
- Assert.Throws (() => {
+ ClassicAssert.Throws (() => {
using (Stream ostm = CompileStringUsing (null, XCodeCompiler.Cpp,
"thisisnotcpp",
null)) {
- Assert.IsNotNull (ostm);
- Assert.IsTrue (ostm.Length > 0);
+ ClassicAssert.IsNotNull (ostm);
+ ClassicAssert.IsTrue (ostm.Length > 0);
}
});
}
@@ -307,20 +429,20 @@ public void HelloWorldObjC ()
using (Stream ostm = CompileStringUsing (null, XCodeCompiler.ObjectiveC,
kHelloObjC,
null)) {
- Assert.IsNotNull (ostm);
- Assert.IsTrue (ostm.Length > 0);
+ ClassicAssert.IsNotNull (ostm);
+ ClassicAssert.IsTrue (ostm.Length > 0);
}
}
[Test]
public void ObjCSyntaxError ()
{
- Assert.Throws (() => {
+ ClassicAssert.Throws (() => {
using (Stream ostm = CompileStringUsing (null, XCodeCompiler.ObjectiveC,
"thisisnotobjc",
null)) {
- Assert.IsNotNull (ostm);
- Assert.IsTrue (ostm.Length > 0);
+ ClassicAssert.IsNotNull (ostm);
+ ClassicAssert.IsTrue (ostm.Length > 0);
}
});
}
@@ -329,12 +451,12 @@ public void ObjCSyntaxError ()
[Test]
public void SwiftSyntaxError ()
{
- Assert.Throws (() => {
+ ClassicAssert.Throws (() => {
using (Stream ostm = CompileStringUsing (null, XCodeCompiler.Swiftc,
"thisisnotswift",
null)) {
- Assert.IsNotNull (ostm);
- Assert.IsTrue (ostm.Length > 0);
+ ClassicAssert.IsNotNull (ostm);
+ ClassicAssert.IsTrue (ostm.Length > 0);
}
});
}
@@ -345,20 +467,20 @@ public void HelloWorldCSharp ()
using (Stream ostm = CompileStringUsing (null, XCodeCompiler.CSharp,
kHelloCSharp,
null)) {
- Assert.IsNotNull (ostm);
- Assert.IsTrue (ostm.Length > 0);
+ ClassicAssert.IsNotNull (ostm);
+ ClassicAssert.IsTrue (ostm.Length > 0);
}
}
[Test]
public void CSharpSyntaxError ()
{
- Assert.Throws (() => {
+ ClassicAssert.Throws (() => {
using (Stream ostm = CompileStringUsing (null, XCodeCompiler.CSharp,
"thisisnotcsharp",
null)) {
- Assert.IsNotNull (ostm);
- Assert.IsTrue (ostm.Length > 0);
+ ClassicAssert.IsNotNull (ostm);
+ ClassicAssert.IsTrue (ostm.Length > 0);
}
});
}
@@ -369,8 +491,8 @@ public void HelloWorldSwiftcCustom ()
using (Stream ostm = CompileStringUsing (null, XCodeCompiler.Swiftc,
kHelloSwift,
null)) {
- Assert.IsNotNull (ostm);
- Assert.IsTrue (ostm.Length > 0);
+ ClassicAssert.IsNotNull (ostm);
+ ClassicAssert.IsTrue (ostm.Length > 0);
}
}
@@ -449,7 +571,7 @@ public static int RunCommandWithLeaks (string executable, StringBuilder args, ID
var rv = ExecAndCollect.RunCommand (executable, args.ToString (), env, output, workingDirectory: workingDirectory ?? string.Empty);
if (rv != 0) {
- var outputStr = output.ToString ();
+ var outputStr = output.ToString ();
Console.WriteLine ($"Test failed to execute (exit code: {rv}):\n{outputStr}");
throw new Exception ($"Test failed to execute (exit code: {rv}):\n{outputStr}");
}
@@ -466,6 +588,66 @@ public static int RunCommandWithLeaks (string executable, StringBuilder args, ID
}
}
+ public static string RunWithDotnet (string filename, string workingDirectory = null, PlatformName platform = PlatformName.None)
+ {
+ // XamGlue is really a framework (XamGlue.framework), and any libraries linked with XamGlue would have a reference to @rpath/XamGlue.framework/XamGlue.
+ // When running the test executable with mono (as opposed to from an actual XM/XI .app), we have no way of specifying rpath (since the executable
+ // is mono itself), so we copy the XamGlue library into the current directory, and fixup any dylibs with references to @rpath/XamGlue.framework/XamGlue
+ // to point to the XamGlue library instead.
+ // If the libraries were compiled properly (linked with the XamGlue library instead of framework), this wouldn't be necessary, but it's simpler to
+ // fixup things here than fix everywhere else.
+ var executablePath = workingDirectory;
+ if (string.IsNullOrEmpty (executablePath)) {
+ executablePath = Path.GetDirectoryName (filename);
+ if (string.IsNullOrEmpty (executablePath))
+ executablePath = Environment.CurrentDirectory;
+ }
+ FixXamGlueReferenceInDylibs (executablePath);
+
+ var args = new StringBuilder ();
+ args.Append ("exec ");
+ args.Append (Exceptions.ThrowOnNull (filename, nameof (filename))).Append (' ');
+ var executable = "/usr/local/share/dotnet/dotnet";
+ var env = new Dictionary ();
+
+ // this will let you see why things might not link
+ // or why libraries might not load (for instance if dependent libraries can't be found)
+ //env.Add ("MONO_LOG_LEVEL", "debug");
+ //env.Add ("MONO_LOG_MASK", "dll");
+ // this will print out every library that was loaded
+ //env.Add ("DYLD_PRINT_LIBRARIES") = "YES";
+ env.Add ("DYLD_LIBRARY_PATH", AddOrAppendPathTo (Environment.GetEnvironmentVariables (), "DYLD_LIBRARY_PATH", $"/usr/lib/swift:{kSwiftRuntimeGlueDirectory}"));
+ switch (platform) {
+ case PlatformName.macOS:
+ // This is really a hack, any tests needing to use XM, should create a proper .app using mmp instead.
+ env.Add ("MONO_PATH", AddOrAppendPathTo (Environment.GetEnvironmentVariables (), "MONO_PATH", $"{ConstructorTests.kSwiftRuntimeMacOutputDirectory}"));
+ env ["DYLD_LIBRARY_PATH"] = AddOrAppendPathTo (env, "DYLD_LIBRARY_PATH", "/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib");
+ break;
+ case PlatformName.None:
+ env.Add ("MONO_PATH", AddOrAppendPathTo (Environment.GetEnvironmentVariables (), "MONO_PATH", $"{ConstructorTests.kSwiftRuntimeOutputDirectory}"));
+ env ["DYLD_LIBRARY_PATH"] = AddOrAppendPathTo (env, "DYLD_LIBRARY_PATH", ".");
+ if (workingDirectory != null)
+ env ["DYLD_LIBRARY_PATH"] = AddOrAppendPathTo (env, "DYLD_LIBRARY_PATH", workingDirectory);
+ break;
+ default:
+ throw new NotImplementedException (platform.ToString ());
+ }
+
+ var sb = new StringBuilder ();
+ // uncomment this to see the DYLD_LIBRARY_PATH in the output.
+ // Do NOT leave this uncommented as it will fail nearly all the tests
+ // sb.AppendLine ("DYLD_LIBRARY_PATH: " + env ["DYLD_LIBRARY_PATH"]);
+
+ var rv = RunCommandWithLeaks (executable, args, env, sb, workingDirectory: workingDirectory ?? string.Empty);
+
+ if (rv != 0) {
+ Console.WriteLine ($"Test failed to execute (exit code: {rv}):\n{sb}");
+ throw new Exception ($"Test failed to execute (exit code: {rv}):\n{sb}");
+ }
+
+ return sb.ToString ();
+ }
+
public static string RunWithMono (string filename, string workingDirectory = null, PlatformName platform = PlatformName.None)
{
// XamGlue is really a framework (XamGlue.framework), and any libraries linked with XamGlue would have a reference to @rpath/XamGlue.framework/XamGlue.
@@ -526,7 +708,7 @@ public static string RunWithMono (string filename, string workingDirectory = nul
return sb.ToString ();
}
- static string AddOrAppendPathTo (System.Collections.IDictionary sd, string key, string value)
+ public static string AddOrAppendPathTo (System.Collections.IDictionary sd, string key, string value)
{
if (sd.Contains (key)) {
return String.Format ("{0}:{1}", sd [key], value);
@@ -566,6 +748,48 @@ public static TempDirectoryFilenameProvider CompileSwiftCode (string pathToCompi
}
return provider;
}
+ static string? csdirectoryCache = null;
+ static string GetCSSdkLocation ()
+ {
+ if (csdirectoryCache is null) {
+ var parentDirectory = "/usr/local/share/dotnet/sdk/";
+ var searchPattern = $"{kframeWorkVersion}.*";
+ csdirectoryCache = MaxDirectory (parentDirectory, searchPattern);
+ }
+ return csdirectoryCache;
+ }
+
+ static string GetDotnetCSCompiler ()
+ {
+ var path = Path.Combine (GetCSSdkLocation (), "Roslyn/bincore/csc.dll");
+ if (!File.Exists (path))
+ throw new Exception ($"Unable to find dotnet cs compiler - expecting it at {path}");
+ return path;
+ }
+
+ static string? refdirectoryCache = null;
+ static string GetReferenceAssemblyLocation ()
+ {
+ // pattern is {sdk}{max}/ref/net{sdk}
+ if (refdirectoryCache is null) {
+ var parentDirectory = "/usr/local/share/dotnet/packs/Microsoft.NETCore.App.Ref/";
+ var searchPattern = $"{kframeWorkVersion}.*";
+ refdirectoryCache = Path.Combine (MaxDirectory (parentDirectory, searchPattern), $"ref/net{kframeWorkVersion}");
+ if (!Directory.Exists (refdirectoryCache))
+ throw new Exception ($"Unable to find dotnet reference assmeblies. Looked in {refdirectoryCache}");
+ }
+ return refdirectoryCache;
+ }
+
+ static string MaxDirectory (string parentDirectory, string searchPattern)
+ {
+ var directories = Directory.GetDirectories (parentDirectory, searchPattern);
+ if (directories.Length == 0) {
+ throw new Exception ($"Unable to find directory using the pattern {parentDirectory}{searchPattern}");
+ }
+ Array.Sort (directories);
+ return directories [directories.Length - 1];
+ }
}
}
diff --git a/tests/tom-swifty-test/Extensions.cs b/tests/tom-swifty-test/Extensions.cs
index 540603f0..acff6054 100644
--- a/tests/tom-swifty-test/Extensions.cs
+++ b/tests/tom-swifty-test/Extensions.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.IO;
using NUnit.Framework;
+using NUnit.Framework.Legacy;
using SwiftReflector;
namespace tomwiftytest {
@@ -32,12 +33,12 @@ public static void CopyTo (this Stream stm, Stream source, int blockSize = 4096)
public static void AssertNoErrors (this ErrorHandling errors, string whileDoing)
{
- Assert.IsFalse (errors.AnyErrors, $"{errors.ErrorCount} error(s) while {whileDoing}");
+ ClassicAssert.IsFalse (errors.AnyErrors, $"{errors.ErrorCount} error(s) while {whileDoing}");
}
public static void AssertNoWarnings (this ErrorHandling errors, string whileDoing)
{
- Assert.IsTrue (errors.WarningCount == 0, $"{errors} warning(s) while {whileDoing}");
+ ClassicAssert.IsTrue (errors.WarningCount == 0, $"{errors} warning(s) while {whileDoing}");
}
}
}
diff --git a/tests/tom-swifty-test/MachOTests.cs b/tests/tom-swifty-test/MachOTests.cs
index d6f17f47..ebf996d4 100644
--- a/tests/tom-swifty-test/MachOTests.cs
+++ b/tests/tom-swifty-test/MachOTests.cs
@@ -8,6 +8,7 @@
using Xamarin;
using System.Linq;
using System.Collections.Generic;
+using NUnit.Framework.Legacy;
namespace tomwiftytest {
[TestFixture]
@@ -23,8 +24,8 @@ public void FromSwiftLibraryMacOS ()
{
Stream lib = HelloSwiftAsLibrary (null);
List macho = MachO.Read (lib, null).ToList ();
- Assert.IsNotNull (macho);
- Assert.AreEqual (1, macho.Count);
+ ClassicAssert.IsNotNull (macho);
+ ClassicAssert.AreEqual (1, macho.Count);
}
[Test]
@@ -32,12 +33,12 @@ public void ContainsASymbolTable ()
{
Stream lib = HelloSwiftAsLibrary (null);
List macho = MachO.Read (lib, null).ToList ();
- Assert.IsNotNull (macho);
- Assert.AreEqual (1, macho.Count);
+ ClassicAssert.IsNotNull (macho);
+ ClassicAssert.AreEqual (1, macho.Count);
MachOFile file = macho [0];
bool hasSymbolTable = file.load_commands.Exists (lc => lc.cmd == (uint)MachO.LoadCommands.SymTab ||
lc.cmd == (uint)MachO.LoadCommands.DySymTab);
- Assert.IsTrue (hasSymbolTable);
+ ClassicAssert.IsTrue (hasSymbolTable);
}
@@ -46,15 +47,15 @@ public void HasOneRealPublicSymbol ()
{
Stream lib = HelloSwiftAsLibrary (null);
List macho = MachO.Read (lib, null).ToList ();
- Assert.IsNotNull (macho);
- Assert.AreEqual (1, macho.Count);
+ ClassicAssert.IsNotNull (macho);
+ ClassicAssert.AreEqual (1, macho.Count);
MachOFile file = macho [0];
List symbols = file.load_commands.OfType ().ToList ();
- Assert.AreEqual (1, symbols.Count);
+ ClassicAssert.AreEqual (1, symbols.Count);
NListEntryType nlet = symbols [0].nlist [0].EntryType;
List entries = symbols [0].nlist.
Where ((nle, i) => nle.IsPublic && nle.EntryType == NListEntryType.InSection).ToList ();
- Assert.AreEqual (1, entries.Count);
+ ClassicAssert.AreEqual (1, entries.Count);
}
}
diff --git a/tests/tom-swifty-test/Makefile b/tests/tom-swifty-test/Makefile
index 130ba2c4..373e15cc 100644
--- a/tests/tom-swifty-test/Makefile
+++ b/tests/tom-swifty-test/Makefile
@@ -11,14 +11,15 @@ all: build run-tests
check: run-tests
-# new (incompatible but much more powerful) runner syntax means using FIXTURES has to look like
-# FIXTURES="--where=test=SwiftReflector.LinkageTests.TestMissingNSObject" make
-# https://github.com/nunit/docs/wiki/Test-Selection-Language
-run-tests: bin/Debug/tom-swifty-test.dll
+# in order to run a single test, do:
+# dotnet test --filter Name=HasBuiltInTypes
+# If you want to do a fully qualified name, do:
+# dotnet test --filter FullyQualifiedName~SwiftReflector.SwiftTypeRegistryTests.HasBuiltInTypes
+run-tests: bin/Debug/net7.0/tom-swifty-test.dll
rm -f .failed-stamp
rm -Rf bin/devicetests # remove any existing device test output
DYLD_LIBRARY_PATH=$(DYLD_LIBRARY_PATH):/usr/lib/swift:$(SWIFTGLUEPREFIX)mac$(SWIFTGLUESUFFIX) \
- mono --debug --runtime=v4.0 $(TOP)/packages/NUnit.ConsoleRunner.3.8.0/tools/nunit3-console.exe bin/Debug/tom-swifty-test.dll --workers=4 --framework=mono-4.0 --nocolor --labels=All --shadowcopy $(FIXTURES) || touch .failed-stamp
+ dotnet test tom-swifty-test.csproj
@# Create an html file and tell MonkeyWrench to upload it (if we're running there)
@[[ -z "$$BUILD_REPOSITORY" ]] || \
( xsltproc ../HtmlTransform.xslt TestResult.xml > index.html && \
@@ -27,14 +28,13 @@ run-tests: bin/Debug/tom-swifty-test.dll
build: bin/Debug/tom-swifty-test.dll
-run-runtime-library-tests: bin/Debug/tom-swifty-test.dll
+run-runtime-library-tests: bin/Debug/net7.0/tom-swifty-test.dll
rm -f .$@-failed-stamp
LEAKTEST_DYLD_LIBRARY_PATH=$(DYLD_LIBRARY_PATH):/usr/lib/swift:$(SWIFTGLUEPREFIX)mac$(SWIFTGLUESUFFIX) \
- $(TOP)/leaktest/bin/Debug/leaktest mono --debug --runtime=v4.0 $(TOP)/packages/NUnit.ConsoleRunner.3.8.0/tools/nunit3-console.exe bin/Debug/tom-swifty-test.dll --workers=1 --framework=mono-4.0 --nocolor --labels=All --shadowcopy --where=namespace=SwiftRuntimeLibraryTests --inprocess || touch .failed-stamp
+ $(TOP)/leaktest/bin/Debug/net7.0/leaktest mono --debug --runtime=v4.0 $(TOP)/packages/NUnit.ConsoleRunner.3.8.0/tools/nunit3-console.exe bin/Debug/net7.0/tom-swifty-test.dll --workers=1 --framework=mono-4.0 --nocolor --labels=All --shadowcopy --where=namespace=SwiftRuntimeLibraryTests --inprocess || touch .failed-stamp
-bin/Debug/tom-swifty-test.dll: $(shell git ls-files . | grep '[.]cs$$') tom-swifty-test.csproj SwiftRuntimeLibrary.Mac.dll.config
- nuget restore ../..
- msbuild
+bin/Debug/net7.0/tom-swifty-test.dll: $(shell git ls-files . | grep '[.]cs$$') tom-swifty-test.csproj SwiftRuntimeLibrary.Mac.dll.config
+ dotnet build
SwiftRuntimeLibrary.Mac.dll.config: SwiftRuntimeLibrary.Mac.dll.config.in Makefile
$(Q) sed -e 's|@SWIFTLIB@|$(SWIFTLIB)|' -e 's|@SWIFTGLUEPREFIX@|$(SWIFTGLUEPREFIX)|' -e 's|@SWIFTGLUESUFFIX@|$(SWIFTGLUESUFFIX)|' $< > $@.tmp
@@ -45,108 +45,3 @@ dependencies: build
clean:
@rm -rf bin obj TestResult.xml devicetests/*
-# Compute the list of test modules
-MODULES:=$(shell ls -d devicetests/*/swiftsrc/*[!_]?????.swift 2>/dev/null | sed -e 's_devicetests/__' -e 's_/swiftsrc__' -e 's_/.*swift__' | uniq)
-
-#
-# Define a template that can compile the swift code for the device tests
-#
-# 1: platform
-# 2: arch
-# 3: target triple
-# 4: module
-# 5: sdk name
-define SwiftModuleTemplate
-bin/devicetests/$(1)/$(2)/$(4): $$(wildcard devicetests/$(4)/swiftsrc/*.swift)
- $$(Q) mkdir -p $$(dir $$@)
- $$(call Q_2,SWIFTC [$(1)/$(2)]) $(SYSTEM_SWIFTC) \
- -emit-module \
- -emit-library \
- -enable-library-evolution \
- -emit-module-interface \
- -g \
- -sdk $$(shell xcrun --sdk "$(5)" --show-sdk-path) \
- -target $(3) \
- -module-name $(4) \
- -o $$@.tmp \
- -Xlinker -final_output -Xlinker $(4) \
- -Xlinker -install_name -Xlinker @rpath/$(4).framework/$(4) \
- -Xlinker -rpath -Xlinker @executable_path/Frameworks \
- -Xlinker -rpath -Xlinker @loader_path/Frameworks \
- $$^
- $$(Q) mv $$@.tmp $$@
-endef
-
-$(foreach module,$(MODULES),$(eval $(call SwiftModuleTemplate,iphone,x86_64,x86_64-apple-ios10.3,$(module),iphonesimulator)))
-$(foreach module,$(MODULES),$(eval $(call SwiftModuleTemplate,iphone,arm64,arm64-apple-ios10.3,$(module),iphoneos)))
-$(foreach module,$(MODULES),$(eval $(call SwiftModuleTemplate,mac,x86_64,x86_64-apple-macosx10.9,$(module),macosx)))
-$(foreach module,$(MODULES),$(eval $(call SwiftModuleTemplate,tvos,x86_64,x86_64-apple-tvos10.2,$(module),appletvsimulator)))
-$(foreach module,$(MODULES),$(eval $(call SwiftModuleTemplate,tvos,arm64,arm64-apple-tvos10.2,$(module),appletvos)))
-$(foreach module,$(MODULES),$(eval $(call SwiftModuleTemplate,watchos,i386,i386-apple-watchos3.2,$(module),watchsimulator)))
-$(foreach module,$(MODULES),$(eval $(call SwiftModuleTemplate,watchos,armv7k,armv7k-apple-watchos3.2,$(module),watchos)))
-
-#
-# Define a template that can create a framework for each device test module.
-#
-# 1: platform
-# 2: module
-# 3: architectures
-define SwiftFrameworkTemplate
-bin/devicetests/$(1)/$(2).framework/$(2): $$(foreach arch,$(3),bin/devicetests/$(1)/$$(arch)/$(2))
- $$(Q) mkdir -p bin/devicetests/$(1)/$(2).framework/Modules/$(2).swiftmodule
- $$(Q) $$(foreach arch,$(3),$(CP) bin/devicetests/$(1)/$$(arch)/$(2).swiftdoc bin/devicetests/$(1)/$(2).framework/Modules/$(2).swiftmodule/$$(arch).swiftdoc &&) true
- $$(Q) $$(foreach arch,$(3),$(CP) bin/devicetests/$(1)/$$(arch)/$(2).swiftmodule bin/devicetests/$(1)/$(2).framework/Modules/$(2).swiftmodule/$$(arch).swiftmodule &&) true
- $$(Q) $$(foreach arch,$(3),$(CP) bin/devicetests/$(1)/$$(arch)/$(2).swiftinterface bin/devicetests/$(1)/$(2).framework/Modules/$(2).swiftmodule/$$(arch).swiftinterface &&) true
- $$(call Q_2,LIPO [$(1)]) lipo $$^ -create -output $$@.tmp
- $$(Q) mv $$@.tmp $$@
-
-bin/devicetests/$(1)/$(2).framework/Info.plist: bin/devicetests/$(1)/$(2).framework/$(2)
- $$(call Q_2,PLIST [$(1)]) $(PLIST_SWIFTY) --lib $$< --output $$@.tmp
- $$(Q) mv $$@.tmp $$@
-
-bin/devicetests/$(1)/$(2).framework.stamp: bin/devicetests/$(1)/$(2).framework/Info.plist bin/devicetests/$(1)/$(2).framework/$(2)
- $$(Q_GEN) touch $$@
-
-bin/devicetests/$(1)/$(2).tom-swifty.stamp: bin/devicetests/$(1)/$(2).framework/$(2)
- $$(call Q_2,SOM [$(1)]) $$(TOM_SWIFTY) \
- --swift-bin-path="$$(SWIFTBIN)" \
- --swift-lib-path="$$(SWIFTLIB)" \
- --retain-xml-reflection \
- --type-database-path="$$(SWIFTBINDINGS)" \
- --retain-swift-wrappers \
- --wrapping-module-name=$(2)Wrapping \
- -C "$$(SWIFTGLUEPREFIX)$(1)$$(SWIFTGLUESUFFIX)" \
- -C "$$(abspath bin/devicetests/$(1)/$(2).framework)" \
- -o "$$(abspath bin/devicetests/$(1)/$(2)/tsout)" \
- --module-name="$(2)"
- $$(Q) touch $$@
-
-build-$(1):: bin/devicetests/$(1)/$(2).tom-swifty.stamp bin/devicetests/$(1)/$(2).framework.stamp bin/devicetests/$(1)/$(2).framework/Info.plist
-endef
-
-$(foreach module,$(MODULES),$(eval $(call SwiftFrameworkTemplate,iphone,$(module),x86_64 arm64)))
-$(foreach module,$(MODULES),$(eval $(call SwiftFrameworkTemplate,mac,$(module),x86_64)))
-$(foreach module,$(MODULES),$(eval $(call SwiftFrameworkTemplate,tvos,$(module),x86_64 arm64)))
-$(foreach module,$(MODULES),$(eval $(call SwiftFrameworkTemplate,watchos,$(module),i386 armv7k)))
-
-tomswiftydevicetests/%/tomswiftydevicetests.csproj: tomswiftydevicetests/%/tomswiftydeviceteststemplate.csproj build-iphone
- $(Q) devicetestsbin/generatecsproj "$*" "$(abspath $(SWIFTLIB))" "$(abspath $(CURDIR)/../../swift-copy-libs/swift-copy-libs)"
-
-csproj-iphone: tomswiftydevicetests/iphone/tomswiftydevicetests.csproj
-
-all-ios: build-iphone csproj-iphone
-
-build-device-tests: all-ios tomswiftydevicetests.zip
-
-tomswiftydevicetests/iphone/bin/iPhone/Debug/tomswiftydevicetests.app: build-iphone csproj-iphone $(wildcard tomswiftydevicetests/*/*.cs)
- msbuild tomswiftydevicetests/iphone/tomswiftydevicetests.csproj /p:Platform=iPhone
-
-run-device-tests: tomswiftydevicetests/iphone/bin/iPhone/Debug/tomswiftydevicetests.app
- ./tomswiftydevicetests/runtests.sh
-
-tomswiftydevicetests.zip: build-iphone csproj-iphone tomswiftydevicetests/iphone/bin/iPhone/Debug/tomswiftydevicetests.app
- $(Q_GEN) rm -f $@
- $(Q) cd tomswiftydevicetests && zip -9r $(abspath $@) iphone/bin/iPhone/Debug/tomswiftydevicetests.app runtests.sh find-device.csharp
-
-print-modules:
- @echo "Modules: $(MODULES)"
diff --git a/tests/tom-swifty-test/PosixUtilsTests.cs b/tests/tom-swifty-test/PosixUtilsTests.cs
index 1f4000e7..b3f3f297 100644
--- a/tests/tom-swifty-test/PosixUtilsTests.cs
+++ b/tests/tom-swifty-test/PosixUtilsTests.cs
@@ -6,8 +6,9 @@
using System.Runtime.InteropServices;
using NUnit.Framework;
+using NUnit.Framework.Legacy;
using SwiftReflector.IOUtils;
-using Mono.Unix;
+
namespace tomwiftytest {
[TestFixture]
@@ -17,7 +18,7 @@ public class PosixUtilsTests {
public void DotWorks ()
{
var finalPath = PosixHelpers.RealPath ("/foo/././././bar");
- Assert.AreEqual ("/foo/bar", finalPath);
+ ClassicAssert.AreEqual ("/foo/bar", finalPath);
}
@@ -25,14 +26,14 @@ public void DotWorks ()
public void DotDotWorks ()
{
var finalPath = PosixHelpers.RealPath ("/foo/bar/baz/../goo");
- Assert.AreEqual ("/foo/bar/goo", finalPath);
+ ClassicAssert.AreEqual ("/foo/bar/goo", finalPath);
}
[Test]
public void DotDotWorks1 ()
{
var finalPath = PosixHelpers.RealPath ("/foo/bar/baz/bing/goo/../../doo");
- Assert.AreEqual ("/foo/bar/baz/doo", finalPath);
+ ClassicAssert.AreEqual ("/foo/bar/baz/doo", finalPath);
}
[Test]
@@ -44,7 +45,7 @@ public void RelativePathsInSymlinks1 ()
var link1 = Path.Combine (dir.DirectoryPath, "link1");
symlink ("../../..", link1);
var finalPath = PosixHelpers.RealPath (link1);
- Assert.AreEqual (expectedPath, finalPath, "1");
+ ClassicAssert.AreEqual (expectedPath, finalPath, "1");
}
}
@@ -57,7 +58,7 @@ public void RelativePathsInSymlinks2 ()
var link2 = Path.Combine (dir.DirectoryPath, "link2");
symlink (Path.Combine (dir.DirectoryPath, "..", "..", ".."), link2);
var finalPath = PosixHelpers.RealPath (link2);
- Assert.AreEqual (expectedPath, finalPath, "2");
+ ClassicAssert.AreEqual (expectedPath, finalPath, "2");
}
}
diff --git a/tests/tom-swifty-test/SwiftReflector/ARCTests.cs b/tests/tom-swifty-test/SwiftReflector/ARCTests.cs
index 9cccac61..8afeca1e 100644
--- a/tests/tom-swifty-test/SwiftReflector/ARCTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/ARCTests.cs
@@ -5,6 +5,7 @@
using Dynamo;
using Dynamo.CSLang;
using NUnit.Framework;
+using NUnit.Framework.Legacy;
using SwiftReflector.Inventory;
using SwiftReflector.IOUtils;
using tomwiftytest;
@@ -60,7 +61,7 @@ public void ArcSingleClass ()
TestRunning.CopyTestReferencesTo (provider.DirectoryPath);
string output = Compiler.RunWithMono (exeOutFilename, provider.DirectoryPath);
- Assert.AreEqual ("nothing\n", output);
+ ClassicAssert.AreEqual ("nothing\n", output);
}
}
@@ -119,7 +120,7 @@ public void ArcClassStruct ()
TestRunning.CopyTestReferencesTo (provider.DirectoryPath);
string output = Compiler.RunWithMono (exeOutFilename, provider.DirectoryPath);
- Assert.AreEqual ("nothing\n", output);
+ ClassicAssert.AreEqual ("nothing\n", output);
}
}
}
diff --git a/tests/tom-swifty-test/SwiftReflector/BindingImportTests.cs b/tests/tom-swifty-test/SwiftReflector/BindingImportTests.cs
index 2946821e..b401f647 100644
--- a/tests/tom-swifty-test/SwiftReflector/BindingImportTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/BindingImportTests.cs
@@ -3,6 +3,7 @@
using System;
using NUnit.Framework;
+using NUnit.Framework.Legacy;
using SwiftReflector.Importing;
using SwiftReflector.TypeMapping;
using tomwiftytest;
@@ -21,8 +22,8 @@ public void LoadsDatabaseSmokeTest (PlatformName platform, int expectedLowerLimi
var errors = new ErrorHandling ();
var importer = new BindingImporter (platform, errors);
var database = importer.Import ();
- Assert.IsNotNull (database, $"null database for {platform}");
- Assert.Less (expectedLowerLimit, database.Count, $"Expected at least {expectedLowerLimit} db entries, but got {database.Count} entries.");
+ ClassicAssert.IsNotNull (database, $"null database for {platform}");
+ ClassicAssert.Less (expectedLowerLimit, database.Count, $"Expected at least {expectedLowerLimit} db entries, but got {database.Count} entries.");
errors.AssertNoErrors ("importing database.");
}
@@ -36,9 +37,9 @@ public void HasAtLeastNSObject (PlatformName platform)
var importer = new BindingImporter (platform, errors);
var database = importer.Import ();
var entity = database.EntityForDotNetName (new DotNetName ("Foundation", "NSObject"));
- Assert.IsNotNull (entity, $"Didn't get an NSObject from database on {platform}");
- Assert.IsTrue (entity.IsObjCClass, $"NSObject is not an ObjC class on {platform}. Seriously?");
- Assert.IsNotNull (entity.Type, $"No type in NSObject on {platform}");
+ ClassicAssert.IsNotNull (entity, $"Didn't get an NSObject from database on {platform}");
+ ClassicAssert.IsTrue (entity.IsObjCClass, $"NSObject is not an ObjC class on {platform}. Seriously?");
+ ClassicAssert.IsNotNull (entity.Type, $"No type in NSObject on {platform}");
errors.AssertNoErrors ("importing database.");
}
@@ -49,7 +50,7 @@ public void ExcludesEverything ()
var importer = new BindingImporter (PlatformName.macOS, errors);
importer.Excludes.Add (new PatternMatch (".*"));
var database = importer.Import ();
- Assert.AreEqual (0, database.Count, $"This was supposed to exclude everything, but we got {database.Count} entries.");
+ ClassicAssert.AreEqual (0, database.Count, $"This was supposed to exclude everything, but we got {database.Count} entries.");
errors.AssertNoErrors ("importing database.");
}
@@ -62,7 +63,7 @@ public void ReincludesNSObject()
importer.Excludes.Add (new PatternMatch (".*"));
importer.Includes.Add (new PatternMatch ("Foundation\\.NSObject"));
var database = importer.Import ();
- Assert.AreEqual (1, database.Count, $"This was supposed to exclude everything, but we got {database.Count} entries.");
+ ClassicAssert.AreEqual (1, database.Count, $"This was supposed to exclude everything, but we got {database.Count} entries.");
errors.AssertNoErrors ("importing database.");
}
@@ -76,7 +77,7 @@ public void ReincludesFoundation ()
importer.Excludes.Add (new PatternMatch (".*"));
importer.Includes.Add (new PatternMatch ("Foundation\\..*"));
var database = importer.Import ();
- Assert.Less (175, database.Count, $"This was supposed to exclude everything, but we got {database.Count} entries.");
+ ClassicAssert.Less (175, database.Count, $"This was supposed to exclude everything, but we got {database.Count} entries.");
errors.AssertNoErrors ("importing database.");
}
@@ -90,9 +91,9 @@ public void LoadsIUIViewControllerTransitionCoordinator (PlatformName platform)
var importer = new BindingImporter (platform, errors);
var database = importer.Import ();
var entity = database.EntityForDotNetName (new DotNetName ("UIKit", "IUIViewControllerTransitionCoordinator"));
- Assert.IsNotNull (entity, $"Didn't get an IUIViewControllerTransitionCoordinator from database on {platform}");
- Assert.IsTrue (entity.IsObjCProtocol, $"NSObject is not an ObjC protocol on {platform}. Seriously?");
- Assert.IsNotNull (entity.Type, $"No type in IUIViewControllerTransitionCoordinator on {platform}");
+ ClassicAssert.IsNotNull (entity, $"Didn't get an IUIViewControllerTransitionCoordinator from database on {platform}");
+ ClassicAssert.IsTrue (entity.IsObjCProtocol, $"NSObject is not an ObjC protocol on {platform}. Seriously?");
+ ClassicAssert.IsNotNull (entity.Type, $"No type in IUIViewControllerTransitionCoordinator on {platform}");
errors.AssertNoErrors ("importing database.");
}
}
diff --git a/tests/tom-swifty-test/SwiftReflector/ClangTargetTests.cs b/tests/tom-swifty-test/SwiftReflector/ClangTargetTests.cs
index 15d8cb86..16345dcc 100644
--- a/tests/tom-swifty-test/SwiftReflector/ClangTargetTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/ClangTargetTests.cs
@@ -1,6 +1,7 @@
using System;
using SwiftReflector;
using NUnit.Framework;
+using NUnit.Framework.Legacy;
namespace SwiftReflector {
@@ -16,7 +17,7 @@ public class ClangTargetTests {
[TestCase ("i386-apple-watchos3.2-simulator", true)]
public void SimulatorTests (string target, bool expected)
{
- Assert.AreEqual (expected, target.ClangTargetIsSimulator (), $"wrong simulator state for {target}");
+ ClassicAssert.AreEqual (expected, target.ClangTargetIsSimulator (), $"wrong simulator state for {target}");
}
}
}
diff --git a/tests/tom-swifty-test/SwiftReflector/ClassWrapTests.cs b/tests/tom-swifty-test/SwiftReflector/ClassWrapTests.cs
index a0fe36b1..26da14c7 100644
--- a/tests/tom-swifty-test/SwiftReflector/ClassWrapTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/ClassWrapTests.cs
@@ -12,7 +12,7 @@
using SwiftReflector.IOUtils;
using Dynamo.CSLang;
using SwiftReflector.Demangling;
-
+using NUnit.Framework.Legacy;
namespace SwiftReflector {
[TestFixture]
@@ -31,7 +31,7 @@ public void TestForFinality ()
ModuleInventory inventory = ModuleInventory.FromFile (montyLib.Filename, errors);
Utils.CheckErrors (errors);
ClassContents cl = inventory.ClassesForName (new SwiftName ("Xython", false)).FirstOrDefault ();
- Assert.IsNotNull (cl);
+ ClassicAssert.IsNotNull (cl);
if (cl.WitnessTable == null || cl.WitnessTable.MangledNames == null ||
cl.WitnessTable.MangledNames.Count () == 0)
@@ -40,9 +40,9 @@ public void TestForFinality ()
foreach (var oi in cl.Methods.Values) {
foreach (TLFunction f in oi.Functions) {
if (f.MangledName.Contains ("finalmethod")) {
- Assert.IsTrue (cl.IsFinal (f));
+ ClassicAssert.IsTrue (cl.IsFinal (f));
} else if (f.MangledName.Contains ("virtmethod")) {
- Assert.IsFalse (cl.IsFinal (f));
+ ClassicAssert.IsFalse (cl.IsFinal (f));
}
}
}
diff --git a/tests/tom-swifty-test/SwiftReflector/CompilationTargetTests.cs b/tests/tom-swifty-test/SwiftReflector/CompilationTargetTests.cs
index 256c029d..19a4c760 100644
--- a/tests/tom-swifty-test/SwiftReflector/CompilationTargetTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/CompilationTargetTests.cs
@@ -6,6 +6,7 @@
using Xamarin;
using System.Linq;
using tomwiftytest;
+using NUnit.Framework.Legacy;
namespace SwiftReflector {
[TestFixture]
@@ -15,20 +16,20 @@ public void MacOSTest ()
{
var target = new CompilationTarget (PlatformName.macOS, TargetCpu.X86_64,
TargetEnvironment.Device, new Version ("14.3"));
- Assert.AreEqual ("x86_64-apple-macosx14.3", target.ToString ());
+ ClassicAssert.AreEqual ("x86_64-apple-macosx14.3", target.ToString ());
}
[Test]
public void CantHaveNullTarget ()
{
- Assert.Throws (typeof (ArgumentNullException), () => new CompilationTarget (PlatformName.iOS, TargetCpu.Arm64,
+ ClassicAssert.Throws (typeof (ArgumentNullException), () => new CompilationTarget (PlatformName.iOS, TargetCpu.Arm64,
TargetEnvironment.Simulator, null));
}
[Test]
public void CantHaveNonePlatform ()
{
- Assert.Throws (typeof (ArgumentOutOfRangeException), () => new CompilationTarget (PlatformName.None, TargetCpu.Arm64,
+ ClassicAssert.Throws (typeof (ArgumentOutOfRangeException), () => new CompilationTarget (PlatformName.None, TargetCpu.Arm64,
TargetEnvironment.Simulator, null));
}
@@ -37,7 +38,7 @@ public void SimulatorOnWatchOS ()
{
var target = new CompilationTarget (PlatformName.watchOS, TargetCpu.I386,
TargetEnvironment.Simulator, new Version ("3.2"));
- Assert.AreEqual ("i386-apple-watchos3.2-simulator", target.ToString ());
+ ClassicAssert.AreEqual ("i386-apple-watchos3.2-simulator", target.ToString ());
}
[Test]
@@ -55,14 +56,14 @@ public void BasicLibraryTest ()
var target = UniformTargetRepresentation.FromPath (moduleName,
new List () { provider.DirectoryPath }, errors);
- Assert.IsNotNull (target, "Didn't get a target");
- Assert.IsNotNull (target.Library);
- Assert.AreEqual (TargetEnvironment.Device, target.Library.Environment, "wrong environment");
- Assert.AreEqual (1, target.Library.Targets.Count, "more targets than we wanted");
- Assert.AreEqual (TargetCpu.X86_64, target.Library.Targets [0].Cpu, "cpu mismatch");
- Assert.AreEqual (PlatformName.macOS, target.Library.OperatingSystem, "operating system mismatch");
- Assert.AreEqual (new Version ("10.9"), target.Library.Targets [0].MinimumOSVersion, "os version mismatch");
- Assert.AreEqual (TargetManufacturer.Apple, target.Library.Targets [0].Manufacturer, "wrong manufacturer");
+ ClassicAssert.IsNotNull (target, "Didn't get a target");
+ ClassicAssert.IsNotNull (target.Library);
+ ClassicAssert.AreEqual (TargetEnvironment.Device, target.Library.Environment, "wrong environment");
+ ClassicAssert.AreEqual (1, target.Library.Targets.Count, "more targets than we wanted");
+ ClassicAssert.AreEqual (TargetCpu.X86_64, target.Library.Targets [0].Cpu, "cpu mismatch");
+ ClassicAssert.AreEqual (PlatformName.macOS, target.Library.OperatingSystem, "operating system mismatch");
+ ClassicAssert.AreEqual (new Version ("10.9"), target.Library.Targets [0].MinimumOSVersion, "os version mismatch");
+ ClassicAssert.AreEqual (TargetManufacturer.Apple, target.Library.Targets [0].Manufacturer, "wrong manufacturer");
}
}
@@ -147,11 +148,11 @@ public void SimpleLibraryTest ()
new List () { TargetCpu.X86_64 }, true)) {
var outputFile = Path.Combine (output.DirectoryPath, "libNoNameModule.dylib");
- Assert.IsTrue (File.Exists (outputFile), "we didn't get a file!");
+ ClassicAssert.IsTrue (File.Exists (outputFile), "we didn't get a file!");
using (var macho = MachO.Read (outputFile, ReadingMode.Immediate)) {
- Assert.AreEqual (1, macho.Count, "wrong contents");
- Assert.AreEqual (MachO.Architectures.x86_64, macho [0].Architecture, "wrong arch");
+ ClassicAssert.AreEqual (1, macho.Count, "wrong contents");
+ ClassicAssert.AreEqual (MachO.Architectures.x86_64, macho [0].Architecture, "wrong arch");
}
}
}
@@ -166,12 +167,12 @@ public void IphoneDeviceFramework ()
new List () { TargetCpu.Arm64 }, false)) {
var outputFile = Path.Combine (output.DirectoryPath, "NoNameModule.framework", "NoNameModule");
- Assert.IsTrue (File.Exists (outputFile), "we didn't get a file!");
+ ClassicAssert.IsTrue (File.Exists (outputFile), "we didn't get a file!");
using (var macho = MachO.Read (outputFile, ReadingMode.Immediate)) {
- Assert.AreEqual (1, macho.Count, "wrong contents");
+ ClassicAssert.AreEqual (1, macho.Count, "wrong contents");
var file = macho.FirstOrDefault (f => f.Architecture == MachO.Architectures.ARM64);
- Assert.IsNotNull (file, "no arm64");
+ ClassicAssert.IsNotNull (file, "no arm64");
}
}
}
@@ -186,14 +187,14 @@ public void IphoneSimulatorFramework ()
new List () { TargetCpu.Arm64, TargetCpu.X86_64 }, null, false)) {
var outputFile = Path.Combine (output.DirectoryPath, "NoNameModule.framework", "NoNameModule");
- Assert.IsTrue (File.Exists (outputFile), "we didn't get a file!");
+ ClassicAssert.IsTrue (File.Exists (outputFile), "we didn't get a file!");
using (var macho = MachO.Read (outputFile, ReadingMode.Immediate)) {
- Assert.AreEqual (2, macho.Count, "wrong contents");
+ ClassicAssert.AreEqual (2, macho.Count, "wrong contents");
var file = macho.FirstOrDefault (f => f.Architecture == MachO.Architectures.ARM64);
- Assert.IsNotNull (file, "no arm64");
+ ClassicAssert.IsNotNull (file, "no arm64");
file = macho.FirstOrDefault (f => f.Architecture == MachO.Architectures.x86_64);
- Assert.IsNotNull (file, "no x86_64");
+ ClassicAssert.IsNotNull (file, "no x86_64");
}
}
}
@@ -210,32 +211,32 @@ public void IphoneXCFramework ()
new List () { TargetCpu.Arm64 }, false)) {
var outputDirectory = Path.Combine (output.DirectoryPath, "NoNameModule.xcframework");
- Assert.IsTrue (Directory.Exists (outputDirectory), "no xcframework");
+ ClassicAssert.IsTrue (Directory.Exists (outputDirectory), "no xcframework");
var deviceFM = Path.Combine (outputDirectory, "ios-arm64", "NoNameModule.framework");
- Assert.IsTrue (Directory.Exists (deviceFM), "no device directory");
+ ClassicAssert.IsTrue (Directory.Exists (deviceFM), "no device directory");
var simFM = Path.Combine (outputDirectory, "ios-arm64_x86_64-simulator", "NoNameModule.framework");
- Assert.IsTrue (Directory.Exists (simFM), "no simulator directory");
+ ClassicAssert.IsTrue (Directory.Exists (simFM), "no simulator directory");
var outputFile = Path.Combine (deviceFM, "NoNameModule");
- Assert.IsTrue (File.Exists (outputFile), "we didn't get a device file!");
+ ClassicAssert.IsTrue (File.Exists (outputFile), "we didn't get a device file!");
using (var macho = MachO.Read (outputFile, ReadingMode.Immediate)) {
- Assert.AreEqual (1, macho.Count, "wrong device contents");
+ ClassicAssert.AreEqual (1, macho.Count, "wrong device contents");
var file = macho.FirstOrDefault (f => f.Architecture == MachO.Architectures.ARM64);
- Assert.IsNotNull (file, "device: no arm64");
+ ClassicAssert.IsNotNull (file, "device: no arm64");
}
outputFile = Path.Combine (simFM, "NoNameModule");
- Assert.IsTrue (File.Exists (outputFile), "we didn't get a simulator file!");
+ ClassicAssert.IsTrue (File.Exists (outputFile), "we didn't get a simulator file!");
using (var macho = MachO.Read (outputFile, ReadingMode.Immediate)) {
- Assert.AreEqual (2, macho.Count, "wrong simulator contents");
+ ClassicAssert.AreEqual (2, macho.Count, "wrong simulator contents");
var file = macho.FirstOrDefault (f => f.Architecture == MachO.Architectures.ARM64);
- Assert.IsNotNull (file, "simulator: no arm64");
+ ClassicAssert.IsNotNull (file, "simulator: no arm64");
file = macho.FirstOrDefault (f => f.Architecture == MachO.Architectures.x86_64);
- Assert.IsNotNull (file, "simulator: no x86_64");
+ ClassicAssert.IsNotNull (file, "simulator: no x86_64");
}
}
}
@@ -252,18 +253,18 @@ public void RoundTripMacLibrary ()
var errors = new ErrorHandling ();
var rep = UniformTargetRepresentation.FromPath ("NoNameModule", new List () { output.DirectoryPath }, errors);
- Assert.IsNotNull (rep, "no representation");
- Assert.IsFalse (errors.AnyErrors, "had errors");
- Assert.IsNotNull (rep.Library, "wasn't a library");
+ ClassicAssert.IsNotNull (rep, "no representation");
+ ClassicAssert.IsFalse (errors.AnyErrors, "had errors");
+ ClassicAssert.IsNotNull (rep.Library, "wasn't a library");
var lib = rep.Library;
- Assert.AreEqual (Path.Combine (output.DirectoryPath, "libNoNameModule.dylib"), lib.Path, "wrong lib path");
- Assert.AreEqual (1, lib.Targets.Count, "wrong number of targets");
+ ClassicAssert.AreEqual (Path.Combine (output.DirectoryPath, "libNoNameModule.dylib"), lib.Path, "wrong lib path");
+ ClassicAssert.AreEqual (1, lib.Targets.Count, "wrong number of targets");
var target = lib.Targets [0];
- Assert.AreEqual (TargetCpu.X86_64, target.Cpu, "wrong cpu");
- Assert.AreEqual (PlatformName.macOS, target.OperatingSystem, "wrong os");
- Assert.AreEqual ("11.0", target.MinimumOSVersion.ToString (), "wrong version");
- Assert.AreEqual (TargetEnvironment.Device, target.Environment, "wrong environment");
+ ClassicAssert.AreEqual (TargetCpu.X86_64, target.Cpu, "wrong cpu");
+ ClassicAssert.AreEqual (PlatformName.macOS, target.OperatingSystem, "wrong os");
+ ClassicAssert.AreEqual ("11.0", target.MinimumOSVersion.ToString (), "wrong version");
+ ClassicAssert.AreEqual (TargetEnvironment.Device, target.Environment, "wrong environment");
}
}
@@ -279,18 +280,18 @@ public void RoundTripMacFramework ()
var errors = new ErrorHandling ();
var rep = UniformTargetRepresentation.FromPath ("NoNameModule", new List () { output.DirectoryPath }, errors);
- Assert.IsNotNull (rep, "no representation");
- Assert.IsFalse (errors.AnyErrors, "had errors");
- Assert.IsNotNull (rep.Framework, "wasn't a framework");
+ ClassicAssert.IsNotNull (rep, "no representation");
+ ClassicAssert.IsFalse (errors.AnyErrors, "had errors");
+ ClassicAssert.IsNotNull (rep.Framework, "wasn't a framework");
var fwk = rep.Framework;
- Assert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.framework"), fwk.Path, "wrong fwk path");
- Assert.AreEqual (1, fwk.Targets.Count, "wrong number of targets");
- Assert.AreEqual (PlatformName.macOS, fwk.OperatingSystem, "wrong os");
- Assert.AreEqual (TargetEnvironment.Device, fwk.Environment, "wrong environment");
+ ClassicAssert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.framework"), fwk.Path, "wrong fwk path");
+ ClassicAssert.AreEqual (1, fwk.Targets.Count, "wrong number of targets");
+ ClassicAssert.AreEqual (PlatformName.macOS, fwk.OperatingSystem, "wrong os");
+ ClassicAssert.AreEqual (TargetEnvironment.Device, fwk.Environment, "wrong environment");
var target = fwk.Targets [0];
- Assert.AreEqual (TargetCpu.X86_64, target.Cpu, "wrong cpu");
- Assert.AreEqual ("11.0", target.MinimumOSVersion.ToString (), "wrong version");
+ ClassicAssert.AreEqual (TargetCpu.X86_64, target.Cpu, "wrong cpu");
+ ClassicAssert.AreEqual ("11.0", target.MinimumOSVersion.ToString (), "wrong version");
}
}
@@ -306,19 +307,19 @@ public void RoundTripiOSDeviceFramework ()
var errors = new ErrorHandling ();
var rep = UniformTargetRepresentation.FromPath ("NoNameModule", new List () { output.DirectoryPath }, errors);
- Assert.IsNotNull (rep, "no representation");
- Assert.IsFalse (errors.AnyErrors, "had errors");
- Assert.IsNotNull (rep.Framework, "wasn't a framework");
+ ClassicAssert.IsNotNull (rep, "no representation");
+ ClassicAssert.IsFalse (errors.AnyErrors, "had errors");
+ ClassicAssert.IsNotNull (rep.Framework, "wasn't a framework");
var fwk = rep.Framework;
- Assert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.framework"), fwk.Path, "wrong fwk path");
- Assert.AreEqual (1, fwk.Targets.Count, "wrong number of targets");
- Assert.AreEqual (PlatformName.iOS, fwk.OperatingSystem, "wrong os");
- Assert.AreEqual (TargetEnvironment.Device, fwk.Environment, "wrong environment");
+ ClassicAssert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.framework"), fwk.Path, "wrong fwk path");
+ ClassicAssert.AreEqual (1, fwk.Targets.Count, "wrong number of targets");
+ ClassicAssert.AreEqual (PlatformName.iOS, fwk.OperatingSystem, "wrong os");
+ ClassicAssert.AreEqual (TargetEnvironment.Device, fwk.Environment, "wrong environment");
foreach (var target in fwk.Targets) {
- Assert.AreEqual ("10.9", target.MinimumOSVersion.ToString (), $"wrong minimum os in {target}");
- Assert.IsTrue (target.Cpu == TargetCpu.Arm64, $"wrong cpu in {target}");
+ ClassicAssert.AreEqual ("10.9", target.MinimumOSVersion.ToString (), $"wrong minimum os in {target}");
+ ClassicAssert.IsTrue (target.Cpu == TargetCpu.Arm64, $"wrong cpu in {target}");
}
}
}
@@ -335,19 +336,19 @@ public void RoundTripiOSSimulatorFramework ()
var errors = new ErrorHandling ();
var rep = UniformTargetRepresentation.FromPath ("NoNameModule", new List () { output.DirectoryPath }, errors);
- Assert.IsNotNull (rep, "no representation");
- Assert.IsFalse (errors.AnyErrors, "had errors");
- Assert.IsNotNull (rep.Framework, "wasn't a framework");
+ ClassicAssert.IsNotNull (rep, "no representation");
+ ClassicAssert.IsFalse (errors.AnyErrors, "had errors");
+ ClassicAssert.IsNotNull (rep.Framework, "wasn't a framework");
var fwk = rep.Framework;
- Assert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.framework"), fwk.Path, "wrong fwk path");
- Assert.AreEqual (2, fwk.Targets.Count, "wrong number of targets");
- Assert.AreEqual (PlatformName.iOS, fwk.OperatingSystem, "wrong os");
- Assert.AreEqual (TargetEnvironment.Simulator, fwk.Environment, "wrong environment");
+ ClassicAssert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.framework"), fwk.Path, "wrong fwk path");
+ ClassicAssert.AreEqual (2, fwk.Targets.Count, "wrong number of targets");
+ ClassicAssert.AreEqual (PlatformName.iOS, fwk.OperatingSystem, "wrong os");
+ ClassicAssert.AreEqual (TargetEnvironment.Simulator, fwk.Environment, "wrong environment");
foreach (var target in fwk.Targets) {
- Assert.AreEqual ("10.9", target.MinimumOSVersion.ToString (), $"wrong minimum os in {target}");
- Assert.IsTrue (target.Cpu == TargetCpu.Arm64 || target.Cpu == TargetCpu.X86_64, $"wrong cpu in {target}");
+ ClassicAssert.AreEqual ("10.9", target.MinimumOSVersion.ToString (), $"wrong minimum os in {target}");
+ ClassicAssert.IsTrue (target.Cpu == TargetCpu.Arm64 || target.Cpu == TargetCpu.X86_64, $"wrong cpu in {target}");
}
}
}
@@ -365,23 +366,23 @@ public void RoundTripiOSXCFramework ()
var errors = new ErrorHandling ();
var rep = UniformTargetRepresentation.FromPath ("NoNameModule", new List () { output.DirectoryPath }, errors);
- Assert.IsNotNull (rep, "no representation");
- Assert.IsFalse (errors.AnyErrors, "had errors");
- Assert.IsNotNull (rep.XCFramework, "wasn't a xcframework");
+ ClassicAssert.IsNotNull (rep, "no representation");
+ ClassicAssert.IsFalse (errors.AnyErrors, "had errors");
+ ClassicAssert.IsNotNull (rep.XCFramework, "wasn't a xcframework");
var xcfwk = rep.XCFramework;
- Assert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.xcframework"), xcfwk.Path, "wrong xcfwk path");
- Assert.AreEqual (2, xcfwk.Frameworks.Count, "wrong number of frameworks");
+ ClassicAssert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.xcframework"), xcfwk.Path, "wrong xcfwk path");
+ ClassicAssert.AreEqual (2, xcfwk.Frameworks.Count, "wrong number of frameworks");
var fwk = xcfwk.Frameworks.FirstOrDefault (fw => fw.Environment == TargetEnvironment.Device);
- Assert.IsNotNull (fwk, "not a device framwwork");
+ ClassicAssert.IsNotNull (fwk, "not a device framwwork");
- Assert.AreEqual (1, fwk.Targets.Count, "wrong number of targets");
- Assert.AreEqual (PlatformName.iOS, fwk.OperatingSystem, "wrong os");
+ ClassicAssert.AreEqual (1, fwk.Targets.Count, "wrong number of targets");
+ ClassicAssert.AreEqual (PlatformName.iOS, fwk.OperatingSystem, "wrong os");
foreach (var target in fwk.Targets) {
- Assert.AreEqual ("10.9", target.MinimumOSVersion.ToString (), $"wrong minimum os in {target}");
- Assert.IsTrue (target.Cpu == TargetCpu.Arm64 || target.Cpu == TargetCpu.X86_64, $"wrong cpu in {target}");
+ ClassicAssert.AreEqual ("10.9", target.MinimumOSVersion.ToString (), $"wrong minimum os in {target}");
+ ClassicAssert.IsTrue (target.Cpu == TargetCpu.Arm64 || target.Cpu == TargetCpu.X86_64, $"wrong cpu in {target}");
}
}
}
@@ -398,19 +399,19 @@ public void RoundTriptvOSDeviceFramework ()
var errors = new ErrorHandling ();
var rep = UniformTargetRepresentation.FromPath ("NoNameModule", new List () { output.DirectoryPath }, errors);
- Assert.IsNotNull (rep, "no representation");
- Assert.IsFalse (errors.AnyErrors, "had errors");
- Assert.IsNotNull (rep.Framework, "wasn't a framework");
+ ClassicAssert.IsNotNull (rep, "no representation");
+ ClassicAssert.IsFalse (errors.AnyErrors, "had errors");
+ ClassicAssert.IsNotNull (rep.Framework, "wasn't a framework");
var fwk = rep.Framework;
- Assert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.framework"), fwk.Path, "wrong fwk path");
- Assert.AreEqual (1, fwk.Targets.Count, "wrong number of targets");
- Assert.AreEqual (PlatformName.tvOS, fwk.OperatingSystem, "wrong os");
- Assert.AreEqual (TargetEnvironment.Device, fwk.Environment, "wrong environment");
+ ClassicAssert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.framework"), fwk.Path, "wrong fwk path");
+ ClassicAssert.AreEqual (1, fwk.Targets.Count, "wrong number of targets");
+ ClassicAssert.AreEqual (PlatformName.tvOS, fwk.OperatingSystem, "wrong os");
+ ClassicAssert.AreEqual (TargetEnvironment.Device, fwk.Environment, "wrong environment");
var target = fwk.Targets [0];
- Assert.AreEqual ("11.0", target.MinimumOSVersion.ToString (), $"wrong minimum os in {target}");
- Assert.AreEqual (TargetCpu.Arm64, target.Cpu, $"wrong cpu in {target}");
+ ClassicAssert.AreEqual ("11.0", target.MinimumOSVersion.ToString (), $"wrong minimum os in {target}");
+ ClassicAssert.AreEqual (TargetCpu.Arm64, target.Cpu, $"wrong cpu in {target}");
}
}
@@ -427,19 +428,19 @@ public void RoundTriptvOSSimulatorFramework ()
var errors = new ErrorHandling ();
var rep = UniformTargetRepresentation.FromPath ("NoNameModule", new List () { output.DirectoryPath }, errors);
- Assert.IsNotNull (rep, "no representation");
- Assert.IsFalse (errors.AnyErrors, "had errors");
- Assert.IsNotNull (rep.Framework, "wasn't a framework");
+ ClassicAssert.IsNotNull (rep, "no representation");
+ ClassicAssert.IsFalse (errors.AnyErrors, "had errors");
+ ClassicAssert.IsNotNull (rep.Framework, "wasn't a framework");
var fwk = rep.Framework;
- Assert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.framework"), fwk.Path, "wrong fwk path");
- Assert.AreEqual (1, fwk.Targets.Count, "wrong number of targets");
- Assert.AreEqual (PlatformName.tvOS, fwk.OperatingSystem, "wrong os");
- Assert.AreEqual (TargetEnvironment.Simulator, fwk.Environment, "wrong environment");
+ ClassicAssert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.framework"), fwk.Path, "wrong fwk path");
+ ClassicAssert.AreEqual (1, fwk.Targets.Count, "wrong number of targets");
+ ClassicAssert.AreEqual (PlatformName.tvOS, fwk.OperatingSystem, "wrong os");
+ ClassicAssert.AreEqual (TargetEnvironment.Simulator, fwk.Environment, "wrong environment");
var target = fwk.Targets [0];
- Assert.AreEqual ("11.0", target.MinimumOSVersion.ToString (), $"wrong minimum os in {target}");
- Assert.AreEqual (TargetCpu.X86_64, target.Cpu, $"wrong cpu in {target}");
+ ClassicAssert.AreEqual ("11.0", target.MinimumOSVersion.ToString (), $"wrong minimum os in {target}");
+ ClassicAssert.AreEqual (TargetCpu.X86_64, target.Cpu, $"wrong cpu in {target}");
}
}
@@ -457,19 +458,19 @@ public void RoundTripwatchOSDeviceFramework ()
var errors = new ErrorHandling ();
var rep = UniformTargetRepresentation.FromPath ("NoNameModule", new List () { output.DirectoryPath }, errors);
- Assert.IsNotNull (rep, "no representation");
- Assert.IsFalse (errors.AnyErrors, "had errors");
- Assert.IsNotNull (rep.Framework, "wasn't a framework");
+ ClassicAssert.IsNotNull (rep, "no representation");
+ ClassicAssert.IsFalse (errors.AnyErrors, "had errors");
+ ClassicAssert.IsNotNull (rep.Framework, "wasn't a framework");
var fwk = rep.Framework;
- Assert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.framework"), fwk.Path, "wrong fwk path");
- Assert.AreEqual (1, fwk.Targets.Count, "wrong number of targets");
- Assert.AreEqual (PlatformName.watchOS, fwk.OperatingSystem, "wrong os");
- Assert.AreEqual (TargetEnvironment.Device, fwk.Environment, "wrong environment");
+ ClassicAssert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.framework"), fwk.Path, "wrong fwk path");
+ ClassicAssert.AreEqual (1, fwk.Targets.Count, "wrong number of targets");
+ ClassicAssert.AreEqual (PlatformName.watchOS, fwk.OperatingSystem, "wrong os");
+ ClassicAssert.AreEqual (TargetEnvironment.Device, fwk.Environment, "wrong environment");
var target = fwk.Targets [0];
- Assert.AreEqual ("7.0", target.MinimumOSVersion.ToString (), $"wrong minimum os in {target}");
- Assert.AreEqual (TargetCpu.Arm64_32, target.Cpu, $"wrong cpu in {target}");
+ ClassicAssert.AreEqual ("7.0", target.MinimumOSVersion.ToString (), $"wrong minimum os in {target}");
+ ClassicAssert.AreEqual (TargetCpu.Arm64_32, target.Cpu, $"wrong cpu in {target}");
}
}
@@ -486,19 +487,19 @@ public void RoundTripwatchOSSimulatorFramework ()
var errors = new ErrorHandling ();
var rep = UniformTargetRepresentation.FromPath ("NoNameModule", new List () { output.DirectoryPath }, errors);
- Assert.IsNotNull (rep, "no representation");
- Assert.IsFalse (errors.AnyErrors, "had errors");
- Assert.IsNotNull (rep.Framework, "wasn't a framework");
+ ClassicAssert.IsNotNull (rep, "no representation");
+ ClassicAssert.IsFalse (errors.AnyErrors, "had errors");
+ ClassicAssert.IsNotNull (rep.Framework, "wasn't a framework");
var fwk = rep.Framework;
- Assert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.framework"), fwk.Path, "wrong fwk path");
- Assert.AreEqual (1, fwk.Targets.Count, "wrong number of targets");
- Assert.AreEqual (PlatformName.watchOS, fwk.OperatingSystem, "wrong os");
- Assert.AreEqual (TargetEnvironment.Simulator, fwk.Environment, "wrong environment");
+ ClassicAssert.AreEqual (Path.Combine (output.DirectoryPath, "NoNameModule.framework"), fwk.Path, "wrong fwk path");
+ ClassicAssert.AreEqual (1, fwk.Targets.Count, "wrong number of targets");
+ ClassicAssert.AreEqual (PlatformName.watchOS, fwk.OperatingSystem, "wrong os");
+ ClassicAssert.AreEqual (TargetEnvironment.Simulator, fwk.Environment, "wrong environment");
var target = fwk.Targets [0];
- Assert.AreEqual ("7.0", target.MinimumOSVersion.ToString (), $"wrong minimum os in {target}");
- Assert.AreEqual (TargetCpu.X86_64, target.Cpu, $"wrong cpu in {target}");
+ ClassicAssert.AreEqual ("7.0", target.MinimumOSVersion.ToString (), $"wrong minimum os in {target}");
+ ClassicAssert.AreEqual (TargetCpu.X86_64, target.Cpu, $"wrong cpu in {target}");
}
}
@@ -511,28 +512,28 @@ public void FromStringOSSuccess (string os, PlatformName platform)
{
var testString = $"i386-apple-{os}10.1";
var compilationTarget = new CompilationTarget (testString);
- Assert.AreEqual (platform, compilationTarget.OperatingSystem, $"wrong os {os}");
- Assert.AreEqual (new Version ("10.1"), compilationTarget.MinimumOSVersion, $"wrong version");
+ ClassicAssert.AreEqual (platform, compilationTarget.OperatingSystem, $"wrong os {os}");
+ ClassicAssert.AreEqual (new Version ("10.1"), compilationTarget.MinimumOSVersion, $"wrong version");
}
[Test]
public void FromStringOSFail ()
{
var testString = $"i386-apple-steveos3.7";
- Assert.Throws (typeof (ArgumentOutOfRangeException), () => new CompilationTarget (testString));
+ ClassicAssert.Throws (typeof (ArgumentOutOfRangeException), () => new CompilationTarget (testString));
}
[Test]
public void FromStringManufacturerSuccess ()
{
var compilationTarget = new CompilationTarget ("i386-apple-ios10.1");
- Assert.AreEqual (TargetManufacturer.Apple, compilationTarget.Manufacturer);
+ ClassicAssert.AreEqual (TargetManufacturer.Apple, compilationTarget.Manufacturer);
}
[Test]
public void FromStringManufacturerFail ()
{
- Assert.Throws (typeof (ArgumentOutOfRangeException), () => new CompilationTarget ("i386-banana-ios10.1"));
+ ClassicAssert.Throws (typeof (ArgumentOutOfRangeException), () => new CompilationTarget ("i386-banana-ios10.1"));
}
[TestCase ("arm64", TargetCpu.Arm64)]
@@ -542,14 +543,14 @@ public void FromStringCpuSuccess (string cpu, TargetCpu targetCpu)
{
var testString = $"{cpu}-apple-ios10.1";
var compilationTarget = new CompilationTarget (testString);
- Assert.AreEqual (targetCpu, compilationTarget.Cpu);
+ ClassicAssert.AreEqual (targetCpu, compilationTarget.Cpu);
}
[Test]
public void FromStringCpuFail ()
{
var testString = $"blah-apple-ios10.1";
- Assert.Throws(typeof (ArgumentOutOfRangeException), () => new CompilationTarget (testString));
+ ClassicAssert.Throws(typeof (ArgumentOutOfRangeException), () => new CompilationTarget (testString));
}
}
}
diff --git a/tests/tom-swifty-test/SwiftReflector/ConstructorTests.cs b/tests/tom-swifty-test/SwiftReflector/ConstructorTests.cs
index c7dec296..bc8ec714 100644
--- a/tests/tom-swifty-test/SwiftReflector/ConstructorTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/ConstructorTests.cs
@@ -11,18 +11,18 @@
using NUnit.Framework;
using tomwiftytest;
using SwiftReflector.TypeMapping;
+using NUnit.Framework.Legacy;
namespace SwiftReflector {
[TestFixture]
[Parallelizable (ParallelScope.All)]
[RunWithLeaks]
public class ConstructorTests {
- public static string kSwiftRuntimeOutputDirectory = Path.Combine (TestContext.CurrentContext.TestDirectory, "../../../../SwiftRuntimeLibrary/bin/Debug");
+ public static string kSwiftRuntimeOutputDirectory = Path.Combine (TestContext.CurrentContext.TestDirectory, $"../../../../../SwiftRuntimeLibrary/bin/Debug/net{Compiler.kframeWorkVersion}");
public const string kSwiftRuntimeLibrary = "SwiftRuntimeLibrary";
-
- public static string kSwiftRuntimeMacOutputDirectory = Path.Combine (TestContext.CurrentContext.TestDirectory, "../../../../SwiftRuntimeLibrary.Mac/bin/Debug");
- public static string kSwiftRuntimeiOSOutputDirectory = Path.Combine (TestContext.CurrentContext.TestDirectory, "../../../../SwiftRuntimeLibrary.iOS/bin/Debug");
+ public static string kSwiftRuntimeMacOutputDirectory = Path.Combine (TestContext.CurrentContext.TestDirectory, $"../../../../../SwiftRuntimeLibrary.Mac/bin/Debug/net{Compiler.kframeWorkVersion}");
+ public static string kSwiftRuntimeiOSOutputDirectory = Path.Combine (TestContext.CurrentContext.TestDirectory, $"../../../../../SwiftRuntimeLibrary.iOS/bin/Debug/net{Compiler.kframeWorkVersion}");
public const string kSwiftRuntimeLibraryMac = "SwiftRuntimeLibrary.Mac";
public const string kSwiftRuntimeLibraryiOS = "SwiftRuntimeLibrary.iOS";
@@ -37,10 +37,10 @@ public void SimpleConstructor ()
var errors = new ErrorHandling ();
ModuleInventory inventory = ModuleInventory.FromStream (stm, errors);
Utils.CheckErrors (errors);
- Assert.AreEqual (1, inventory.Classes.Count ());
+ ClassicAssert.AreEqual (1, inventory.Classes.Count ());
ClassContents cl = inventory.Classes.First ();
- Assert.AreEqual ("noname.None", cl.Name.ToFullyQualifiedName ());
- Assert.AreEqual (2, cl.Constructors.Values.Count ());
+ ClassicAssert.AreEqual ("noname.None", cl.Name.ToFullyQualifiedName ());
+ ClassicAssert.AreEqual (2, cl.Constructors.Values.Count ());
}
}
@@ -48,16 +48,16 @@ public void SimpleConstructor ()
[Test]
public void SwiftRuntimeLibraryExists ()
{
- Assert.IsTrue (Directory.Exists (kSwiftRuntimeOutputDirectory));
- Assert.IsTrue (File.Exists (Path.Combine (kSwiftRuntimeOutputDirectory, kSwiftRuntimeLibrary + ".dll")));
+ ClassicAssert.IsTrue (Directory.Exists (kSwiftRuntimeOutputDirectory));
+ ClassicAssert.IsTrue (File.Exists (Path.Combine (kSwiftRuntimeOutputDirectory, kSwiftRuntimeLibrary + ".dll")));
}
[Test]
public void SwiftRuntimeLibraryMacExists ()
{
- Assert.IsTrue (Directory.Exists (kSwiftRuntimeMacOutputDirectory));
- Assert.IsTrue (File.Exists (Path.Combine (kSwiftRuntimeMacOutputDirectory, kSwiftRuntimeLibraryMac + ".dll")));
+ ClassicAssert.IsTrue (Directory.Exists (kSwiftRuntimeMacOutputDirectory));
+ ClassicAssert.IsTrue (File.Exists (Path.Combine (kSwiftRuntimeMacOutputDirectory, kSwiftRuntimeLibraryMac + ".dll")));
}
diff --git a/tests/tom-swifty-test/SwiftReflector/DecomposerTests.cs b/tests/tom-swifty-test/SwiftReflector/DecomposerTests.cs
index 5bfe5d33..c387c33b 100644
--- a/tests/tom-swifty-test/SwiftReflector/DecomposerTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/DecomposerTests.cs
@@ -13,6 +13,7 @@
using Dynamo.CSLang;
using Dynamo;
using SwiftReflector.TypeMapping;
+using NUnit.Framework.Legacy;
namespace SwiftReflector {
[TestFixture]
@@ -24,12 +25,12 @@ public void DecomposeSmokeTest ()
{
var func = Decomposer.Decompose ("_$s3foo6AClassC3barSiycyF", true) as TLFunction;
var uncurriedFunc = func.Signature as SwiftUncurriedFunctionType;
- Assert.IsNotNull (func, "func");
- Assert.AreEqual ("foo", func.Module.Name, "modulename");
- Assert.AreEqual (1, func.Class.ClassName.Nesting.Count, "nesting count");
- Assert.AreEqual ("AClass", func.Class.ClassName.NestingNames [0].Name, "AClass");
- Assert.AreEqual ("bar", func.Name.Name, "bar");
- Assert.IsNotNull (uncurriedFunc, "uncurriedFunc");
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.AreEqual ("foo", func.Module.Name, "modulename");
+ ClassicAssert.AreEqual (1, func.Class.ClassName.Nesting.Count, "nesting count");
+ ClassicAssert.AreEqual ("AClass", func.Class.ClassName.NestingNames [0].Name, "AClass");
+ ClassicAssert.AreEqual ("bar", func.Name.Name, "bar");
+ ClassicAssert.IsNotNull (uncurriedFunc, "uncurriedFunc");
}
[Test]
@@ -38,92 +39,92 @@ public void HasNLEntries ()
var stm = MachOTests.HelloSwiftAsLibrary (null);
var entries = SymbolVisitor.Entries (stm).ToList ();
- Assert.AreEqual (1, entries.Count (), "1 entry");
+ ClassicAssert.AreEqual (1, entries.Count (), "1 entry");
var isSwift3Str = entries [0].Entry.str == "__TF6noname4mainFT_SS";
var isSwift4Str = entries [0].Entry.str == "__T06noname4mainSSyF";
var isSwift5Str = entries [0].Entry.str == "_$s6noname4mainSSyF";
- Assert.IsTrue (isSwift3Str || isSwift4Str || isSwift5Str, "matches a platform");
+ ClassicAssert.IsTrue (isSwift3Str || isSwift4Str || isSwift5Str, "matches a platform");
}
[Test]
public void PunyCode ()
{
- Assert.AreEqual (Char.ConvertFromUtf32 (0x1F49B), "GrIh".DePunyCode ());
+ ClassicAssert.AreEqual (Char.ConvertFromUtf32 (0x1F49B), "GrIh".DePunyCode ());
}
[Test]
public void TestFuncVoidReturningVoid ()
{
var func = Decomposer.Decompose ("_$s3foo6lonelyyyF", true) as TLFunction;
- Assert.IsNotNull (func, "func");
- Assert.AreEqual ("foo", func.Module.Name, "module");
- Assert.IsNotNull (func.Signature, "signature");
- Assert.IsTrue (func.Signature.IsVoid, "IsVoid");
- Assert.AreEqual (CoreCompoundType.Tuple, func.Signature.ReturnType.Type, "Is tuple");
- Assert.IsTrue (((SwiftTupleType)func.Signature.ReturnType).IsEmpty, "Is empty tuple");
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.AreEqual ("foo", func.Module.Name, "module");
+ ClassicAssert.IsNotNull (func.Signature, "signature");
+ ClassicAssert.IsTrue (func.Signature.IsVoid, "IsVoid");
+ ClassicAssert.AreEqual (CoreCompoundType.Tuple, func.Signature.ReturnType.Type, "Is tuple");
+ ClassicAssert.IsTrue (((SwiftTupleType)func.Signature.ReturnType).IsEmpty, "Is empty tuple");
}
[Test]
public void TestEmptyConstructor ()
{
var func = Decomposer.Decompose ("_$s3foo5JuliaCACycfC"/*"__TFC3foo5JuliaCfMS0_FT_S0_"*/, true) as TLFunction;
- Assert.IsNotNull (func, "func");
- Assert.AreEqual ("foo", func.Module.Name, "module");
- Assert.IsNotNull (func.Signature, "signature");
- Assert.IsFalse (func.Signature.IsVoid, "IsVoid");
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.AreEqual ("foo", func.Module.Name, "module");
+ ClassicAssert.IsNotNull (func.Signature, "signature");
+ ClassicAssert.IsFalse (func.Signature.IsVoid, "IsVoid");
var cons = func.Signature as SwiftConstructorType;
- Assert.AreEqual (func.Class, cons.ReturnType, "is a class");
- Assert.AreEqual (CoreCompoundType.Tuple, func.Signature.Parameters.Type, "is a tuple");
- Assert.IsTrue (((SwiftTupleType)func.Signature.Parameters).IsEmpty, "is empty tuple");
+ ClassicAssert.AreEqual (func.Class, cons.ReturnType, "is a class");
+ ClassicAssert.AreEqual (CoreCompoundType.Tuple, func.Signature.Parameters.Type, "is a tuple");
+ ClassicAssert.IsTrue (((SwiftTupleType)func.Signature.Parameters).IsEmpty, "is empty tuple");
}
[Test]
public void TestIntConstructor ()
{
var func = Decomposer.Decompose ("_$s3foo5JuliaC5stuffACSi_tcfc", true) as TLFunction;
- Assert.IsNotNull (func, "func");
- Assert.AreEqual ("foo", func.Module.Name, "module");
- Assert.IsNotNull (func.Signature, "signature");
- Assert.IsFalse (func.Signature.IsVoid, "IsVoid");
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.AreEqual ("foo", func.Module.Name, "module");
+ ClassicAssert.IsNotNull (func.Signature, "signature");
+ ClassicAssert.IsFalse (func.Signature.IsVoid, "IsVoid");
var cons = func.Signature as SwiftConstructorType;
- Assert.AreEqual (func.Class, cons.ReturnType, "is a class");
+ ClassicAssert.AreEqual (func.Class, cons.ReturnType, "is a class");
var bit = func.Signature.GetParameter (0) as SwiftBuiltInType;
- Assert.NotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType);
+ ClassicAssert.NotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType);
}
[Test]
public void TestClassConstructor ()
{
var func = Decomposer.Decompose ("_$s3foo5JuliaCMa", true) as TLFunction;
- Assert.IsNotNull (func, "func");
- Assert.AreEqual ("foo", func.Module.Name, "module");
- Assert.IsNotNull (func.Signature, "signature");
- Assert.IsFalse (func.Signature.IsVoid, "IsVoid");
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.AreEqual ("foo", func.Module.Name, "module");
+ ClassicAssert.IsNotNull (func.Signature, "signature");
+ ClassicAssert.IsFalse (func.Signature.IsVoid, "IsVoid");
var cctor = func.Signature as SwiftClassConstructorType;
- Assert.IsNotNull (cctor, "cctor");
+ ClassicAssert.IsNotNull (cctor, "cctor");
var mct = cctor.ReturnType as SwiftMetaClassType;
- Assert.AreEqual (func.Class, mct.Class, "class type");
- Assert.AreEqual (CoreCompoundType.Tuple, func.Signature.Parameters.Type, "is a tuple");
- Assert.IsTrue (((SwiftTupleType)func.Signature.Parameters).IsEmpty, "is empty");
+ ClassicAssert.AreEqual (func.Class, mct.Class, "class type");
+ ClassicAssert.AreEqual (CoreCompoundType.Tuple, func.Signature.Parameters.Type, "is a tuple");
+ ClassicAssert.IsTrue (((SwiftTupleType)func.Signature.Parameters).IsEmpty, "is empty");
}
void TestFunc3XXXReturningVoid (string funcmangle, CoreBuiltInType csv)
{
var func = Decomposer.Decompose (funcmangle, true) as TLFunction;
- Assert.IsNotNull (func, "func");
- Assert.AreEqual ("foo", func.Module.Name, "module");
- Assert.IsNotNull (func.Signature, "signature");
- Assert.IsTrue (func.Signature.IsVoid, "IsVoid");
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.AreEqual ("foo", func.Module.Name, "module");
+ ClassicAssert.IsNotNull (func.Signature, "signature");
+ ClassicAssert.IsTrue (func.Signature.IsVoid, "IsVoid");
var parms = func.Signature.Parameters;
- Assert.IsNotNull (parms, "parms");
+ ClassicAssert.IsNotNull (parms, "parms");
var tt = parms as SwiftTupleType;
- Assert.IsNotNull (tt, "tt");
- Assert.AreEqual (3, tt.Contents.Count, "tuple size");
+ ClassicAssert.IsNotNull (tt, "tt");
+ ClassicAssert.AreEqual (3, tt.Contents.Count, "tuple size");
foreach (SwiftType st in tt.Contents) {
SwiftBuiltInType scalar = st as SwiftBuiltInType;
- Assert.IsNotNull (scalar, "scalar");
- Assert.AreEqual (csv, scalar.BuiltInType, "scalar type");
+ ClassicAssert.IsNotNull (scalar, "scalar");
+ ClassicAssert.AreEqual (csv, scalar.BuiltInType, "scalar type");
}
}
@@ -164,15 +165,15 @@ public void TestFunc3UIntsReturningVoid ()
void TestFuncReturningFoo (string funcMangle, CoreBuiltInType cbt)
{
var func = Decomposer.Decompose (funcMangle, true) as TLFunction;
- Assert.IsNotNull (func, "func");
- Assert.AreEqual ("foo", func.Module.Name, "module");
- Assert.IsNotNull (func.Signature, "signature");
- Assert.IsFalse (func.Signature.IsVoid, "IsVoid");
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.AreEqual ("foo", func.Module.Name, "module");
+ ClassicAssert.IsNotNull (func.Signature, "signature");
+ ClassicAssert.IsFalse (func.Signature.IsVoid, "IsVoid");
var ret = func.Signature.ReturnType;
var st = ret as SwiftBuiltInType;
- Assert.IsNotNull (st, "st");
- Assert.AreEqual (cbt, st.BuiltInType, "matches type");
+ ClassicAssert.IsNotNull (st, "st");
+ ClassicAssert.AreEqual (cbt, st.BuiltInType, "matches type");
}
@@ -211,21 +212,21 @@ static void BuiltInTypeIsA (SwiftType t, CoreBuiltInType ct)
{
SwiftBuiltInType bit = t as SwiftBuiltInType;
if (bit == null)
- Assert.Fail ("Not a SwiftBuiltInType: " + t.GetType ().Name);
- Assert.AreEqual (ct, bit.BuiltInType, "same built in type");
+ ClassicAssert.Fail ("Not a SwiftBuiltInType: " + t.GetType ().Name);
+ ClassicAssert.AreEqual (ct, bit.BuiltInType, "same built in type");
}
[Test]
public void TestSimpleArrayOfInt ()
{
var func = Decomposer.Decompose ("_$s3foo6nonameyySaySiGF", true) as TLFunction;
- Assert.IsNotNull (func, "func");
+ ClassicAssert.IsNotNull (func, "func");
var gentype = func.Signature.Parameters as SwiftBoundGenericType;
- Assert.IsNotNull (gentype, "gentype");
- Assert.IsTrue (gentype.BaseType is SwiftClassType, "is a class type");
+ ClassicAssert.IsNotNull (gentype, "gentype");
+ ClassicAssert.IsTrue (gentype.BaseType is SwiftClassType, "is a class type");
var sct = gentype.BaseType as SwiftClassType;
- Assert.AreEqual ("Swift.Array", sct.ClassName.ToFullyQualifiedName (true), "is Swift.Array");
- Assert.AreEqual (1, gentype.BoundTypes.Count, "1 bound type");
+ ClassicAssert.AreEqual ("Swift.Array", sct.ClassName.ToFullyQualifiedName (true), "is Swift.Array");
+ ClassicAssert.AreEqual (1, gentype.BoundTypes.Count, "1 bound type");
BuiltInTypeIsA (gentype.BoundTypes [0], CoreBuiltInType.Int);
}
@@ -233,21 +234,21 @@ public void TestSimpleArrayOfInt ()
public void TestSimpleArrayOfArrayOfInt ()
{
var func = Decomposer.Decompose ("_$s3foo6nonameyySaySaySiGGF", true) as TLFunction;
- Assert.IsNotNull (func, "func");
+ ClassicAssert.IsNotNull (func, "func");
var gentype = func.Signature.Parameters as SwiftBoundGenericType;
- Assert.IsNotNull (gentype, "gentype");
- Assert.IsTrue (gentype.BaseType is SwiftClassType, "is class");
+ ClassicAssert.IsNotNull (gentype, "gentype");
+ ClassicAssert.IsTrue (gentype.BaseType is SwiftClassType, "is class");
var sct = gentype.BaseType as SwiftClassType;
- Assert.AreEqual ("Swift.Array", sct.ClassName.ToFullyQualifiedName (true), "is array");
+ ClassicAssert.AreEqual ("Swift.Array", sct.ClassName.ToFullyQualifiedName (true), "is array");
- Assert.AreEqual (1, gentype.BoundTypes.Count);
- Assert.IsTrue (gentype.BoundTypes [0] is SwiftBoundGenericType, "is generic");
+ ClassicAssert.AreEqual (1, gentype.BoundTypes.Count);
+ ClassicAssert.IsTrue (gentype.BoundTypes [0] is SwiftBoundGenericType, "is generic");
gentype = gentype.BoundTypes [0] as SwiftBoundGenericType;
- Assert.IsTrue (gentype.BaseType is SwiftClassType, "is class");
+ ClassicAssert.IsTrue (gentype.BaseType is SwiftClassType, "is class");
sct = gentype.BaseType as SwiftClassType;
- Assert.AreEqual ("Swift.Array", sct.ClassName.ToFullyQualifiedName (true), "is array");
+ ClassicAssert.AreEqual ("Swift.Array", sct.ClassName.ToFullyQualifiedName (true), "is array");
- Assert.AreEqual (1, gentype.BoundTypes.Count);
+ ClassicAssert.AreEqual (1, gentype.BoundTypes.Count);
BuiltInTypeIsA (gentype.BoundTypes [0], CoreBuiltInType.Int);
}
@@ -255,11 +256,11 @@ public void TestSimpleArrayOfArrayOfInt ()
public void TestSimpleDictIntOnBool ()
{
var func = Decomposer.Decompose ("_$s3foo6nonameyySDySiSbGF", true) as TLFunction;
- Assert.IsNotNull (func, "func");
+ ClassicAssert.IsNotNull (func, "func");
var gentype = func.Signature.Parameters as SwiftBoundGenericType;
- Assert.IsNotNull (gentype, "gentype");
- Assert.IsTrue (gentype.BaseType is SwiftClassType, "is class");
- Assert.AreEqual (2, gentype.BoundTypes.Count, "2 bound types");
+ ClassicAssert.IsNotNull (gentype, "gentype");
+ ClassicAssert.IsTrue (gentype.BaseType is SwiftClassType, "is class");
+ ClassicAssert.AreEqual (2, gentype.BoundTypes.Count, "2 bound types");
BuiltInTypeIsA (gentype.BoundTypes [0], CoreBuiltInType.Int);
BuiltInTypeIsA (gentype.BoundTypes [1], CoreBuiltInType.Bool);
}
@@ -270,7 +271,7 @@ public void TestTLFunctionUsingClass ()
{
var funcName = "_$s17unitHelpFrawework13xamarin_MontyC3valyyAA0E0CF";
var func = Decomposer.Decompose (funcName, true) as TLFunction;
- Assert.IsNotNull (func, "func");
+ ClassicAssert.IsNotNull (func, "func");
}
@@ -279,12 +280,12 @@ public void TestTLFunctionPublicGetter ()
{
var funcName = "_$s17unitHelpFrawework4NoneC8somePropSivg";
var func = Decomposer.Decompose (funcName, true) as TLFunction;
- Assert.IsNotNull (func, "func");
+ ClassicAssert.IsNotNull (func, "func");
var prop = func.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsTrue (prop.IsPublic, "IsPublic");
- Assert.AreEqual (PropertyType.Getter, prop.PropertyType, "PropertyType");
- Assert.IsNull (prop.PrivateName, "PrivateName");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsTrue (prop.IsPublic, "IsPublic");
+ ClassicAssert.AreEqual (PropertyType.Getter, prop.PropertyType, "PropertyType");
+ ClassicAssert.IsNull (prop.PrivateName, "PrivateName");
}
[Test]
@@ -292,12 +293,12 @@ public void TestTLFunctionPublicSetter ()
{
var funcName = "_$s17unitHelpFrawework4NoneC8somePropSivs";
var func = Decomposer.Decompose (funcName, true) as TLFunction;
- Assert.IsNotNull (func, "func");
+ ClassicAssert.IsNotNull (func, "func");
var prop = func.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsTrue (prop.IsPublic, "IsPublic");
- Assert.AreEqual (PropertyType.Setter, prop.PropertyType, "PropertyType");
- Assert.IsNull (prop.PrivateName, "PrivateName");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsTrue (prop.IsPublic, "IsPublic");
+ ClassicAssert.AreEqual (PropertyType.Setter, prop.PropertyType, "PropertyType");
+ ClassicAssert.IsNull (prop.PrivateName, "PrivateName");
}
[Test]
@@ -306,12 +307,12 @@ public void TestTLFunctionPublicMaterializer ()
{
var funcName = "";
var func = Decomposer.Decompose (funcName, true) as TLFunction;
- Assert.IsNotNull (func, "func");
+ ClassicAssert.IsNotNull (func, "func");
var prop = func.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsTrue (prop.IsPublic, "IsPublic");
- Assert.AreEqual (PropertyType.Materializer, prop.PropertyType, "PropertyType");
- Assert.IsNull (prop.PrivateName, "PrivateName");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsTrue (prop.IsPublic, "IsPublic");
+ ClassicAssert.AreEqual (PropertyType.Materializer, prop.PropertyType, "PropertyType");
+ ClassicAssert.IsNull (prop.PrivateName, "PrivateName");
}
[Test]
@@ -319,12 +320,12 @@ public void TestTLFunctionPublicModifyAccessor ()
{
var funcName = "_$s17unitHelpFrawework4NoneC8somePropSivM";
var func = Decomposer.Decompose (funcName, true) as TLFunction;
- Assert.IsNotNull (func, "func");
+ ClassicAssert.IsNotNull (func, "func");
var prop = func.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsTrue (prop.IsPublic, "public");
- Assert.AreEqual (PropertyType.ModifyAccessor, prop.PropertyType, "is modify accessor");
- Assert.IsNull (prop.PrivateName, "no private name");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsTrue (prop.IsPublic, "public");
+ ClassicAssert.AreEqual (PropertyType.ModifyAccessor, prop.PropertyType, "is modify accessor");
+ ClassicAssert.IsNull (prop.PrivateName, "no private name");
}
[Test]
@@ -333,7 +334,7 @@ public void TestTLFunctionPublicMaterializer1 ()
{
var funcName = "";
var func = Decomposer.Decompose (funcName, true) as TLFunction;
- Assert.IsNotNull (func, "func");
+ ClassicAssert.IsNotNull (func, "func");
}
@@ -342,12 +343,12 @@ public void TestTLFunctionPrivateGetter ()
{
var funcName = "_$s17unitHelpFrawework4NoneC2_x33_3D85A716E8AC30D62D97E78DB643A23DLLSivg";//"__TFC5None14NonegP33_8C43D7A2FD5ECCB447AC5E0DDCF4B73C10someBackerSi\n";
var func = Decomposer.Decompose (funcName, true) as TLFunction;
- Assert.IsNotNull (func, "func");
+ ClassicAssert.IsNotNull (func, "func");
var prop = func.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsTrue (prop.IsPrivate, "IsPrivate");
- Assert.AreEqual (PropertyType.Getter, prop.PropertyType, "PropertyType");
- Assert.IsNotNull (prop.PrivateName, "PrivateName");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsTrue (prop.IsPrivate, "IsPrivate");
+ ClassicAssert.AreEqual (PropertyType.Getter, prop.PropertyType, "PropertyType");
+ ClassicAssert.IsNotNull (prop.PrivateName, "PrivateName");
}
[Test]
@@ -355,12 +356,12 @@ public void TestTLFunctionPrivateSetter ()
{
var funcName = "_$s17unitHelpFrawework4NoneC2_x33_3D85A716E8AC30D62D97E78DB643A23DLLSivs";
var func = Decomposer.Decompose (funcName, true) as TLFunction;
- Assert.IsNotNull (func, "func");
+ ClassicAssert.IsNotNull (func, "func");
var prop = func.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsTrue (prop.IsPrivate, "IsPrivate");
- Assert.AreEqual (PropertyType.Setter, prop.PropertyType, "PropertyType");
- Assert.IsNotNull (prop.PrivateName, "PrivateName");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsTrue (prop.IsPrivate, "IsPrivate");
+ ClassicAssert.AreEqual (PropertyType.Setter, prop.PropertyType, "PropertyType");
+ ClassicAssert.IsNotNull (prop.PrivateName, "PrivateName");
}
[Test]
@@ -369,12 +370,12 @@ public void TestTLFunctionPrivateMaterializer ()
{
var funcName = "__TFC5None14NonemP33_8C43D7A2FD5ECCB447AC5E0DDCF4B73C10someBackerSi";
var func = Decomposer.Decompose (funcName, true) as TLFunction;
- Assert.IsNotNull (func, "func");
+ ClassicAssert.IsNotNull (func, "func");
var prop = func.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsTrue (prop.IsPrivate, "IsPrivate");
- Assert.AreEqual (PropertyType.Materializer, prop.PropertyType, "PropertyType");
- Assert.IsNotNull (prop.PrivateName, "PrivateName");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsTrue (prop.IsPrivate, "IsPrivate");
+ ClassicAssert.AreEqual (PropertyType.Materializer, prop.PropertyType, "PropertyType");
+ ClassicAssert.IsNotNull (prop.PrivateName, "PrivateName");
}
[Test]
@@ -382,19 +383,19 @@ public void TestTLFunctionPrivateModifyAccessor ()
{
var funcName = "_$s17unitHelpFrawework4NoneC2_x33_3D85A716E8AC30D62D97E78DB643A23DLLSivM";
var func = Decomposer.Decompose (funcName, true) as TLFunction;
- Assert.IsNotNull (func, "func");
+ ClassicAssert.IsNotNull (func, "func");
var prop = func.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsTrue (prop.IsPrivate);
- Assert.AreEqual (PropertyType.ModifyAccessor, prop.PropertyType, "PropertyType");
- Assert.IsNotNull (prop.PrivateName, "PrivateName");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsTrue (prop.IsPrivate);
+ ClassicAssert.AreEqual (PropertyType.ModifyAccessor, prop.PropertyType, "PropertyType");
+ ClassicAssert.IsNotNull (prop.PrivateName, "PrivateName");
}
[Test]
public void HasMono64 ()
{
if (!File.Exists (Compiler.kMono64Path))
- Assert.Fail ("unable to find mono64 at location " + Compiler.kMono64Path);
+ ClassicAssert.Fail ("unable to find mono64 at location " + Compiler.kMono64Path);
}
@@ -403,12 +404,12 @@ public void TestFuncOfClassReturningClassInSameModule ()
{
var func = "_$s17unitHelpFrawework13xamarin_MontyC4doItyAA6GarbleCAA0E0CF";
var tlf = Decomposer.Decompose (func, true) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var bft = tlf.Signature as SwiftBaseFunctionType;
- Assert.IsNotNull (bft, "bft");
+ ClassicAssert.IsNotNull (bft, "bft");
var sct = bft.ReturnType as SwiftClassType;
- Assert.IsNotNull (sct, "sct");
- Assert.AreEqual ("unitHelpFrawework.Garble", sct.ClassName.ToFullyQualifiedName ());
+ ClassicAssert.IsNotNull (sct, "sct");
+ ClassicAssert.AreEqual ("unitHelpFrawework.Garble", sct.ClassName.ToFullyQualifiedName ());
}
@@ -417,12 +418,12 @@ public void TestFuncWithInOutArgument ()
{
var func = "_$s17unitHelpFrawework9OneStructV9mutateVaryySizF";
var tlf = Decomposer.Decompose (func, true) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var bft = tlf.Signature as SwiftBaseFunctionType;
- Assert.IsNotNull (bft, "bft");
+ ClassicAssert.IsNotNull (bft, "bft");
var argType = bft.Parameters as SwiftBuiltInType;
- Assert.IsNotNull (argType, "argType");
- Assert.IsTrue (argType.IsReference, "IsReference");
+ ClassicAssert.IsNotNull (argType, "argType");
+ ClassicAssert.IsTrue (argType.IsReference, "IsReference");
}
[Test]
@@ -430,7 +431,7 @@ public void TestStructMeta ()
{
var func = "_$s17unitHelpFrawework7AStructVN";
var def = Decomposer.Decompose (func, true) as TLDefinition;
- Assert.IsNotNull (def, "def");
+ ClassicAssert.IsNotNull (def, "def");
}
@@ -439,8 +440,8 @@ public void DecomposeStructConstructor ()
{
var func = "_$s17unitHelpFrawework7AStructVACycfC";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.IsTrue (tlf.Signature is SwiftConstructorType, "is constructor");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsTrue (tlf.Signature is SwiftConstructorType, "is constructor");
}
[Test]
@@ -448,8 +449,8 @@ public void DecomposeGlobalAddressor ()
{
var func = "_$s17unitHelpFrawework7aGlobalSbvau";
var tlf = Decomposer.Decompose (func, false) as TLUnsafeMutableAddressor;
- Assert.IsNotNull (tlf, "tlf");
- Assert.IsNotNull (tlf.OfType, "OfType");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf.OfType, "OfType");
}
[Test]
@@ -457,7 +458,7 @@ public void DecomposeGlobalVariable ()
{
var func = "_$s17unitHelpFrawework7aGlobalSbvp";
var vari = Decomposer.Decompose (func, false) as TLVariable;
- Assert.IsNotNull (vari, "vari");
+ ClassicAssert.IsNotNull (vari, "vari");
}
@@ -467,12 +468,12 @@ public void DecomposeFunctionOfEnum ()
{
var func = "_$s17unitHelpFrawework10printFirstyyAA0E0OF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.IsTrue (tlf.Signature.ReturnType.IsEmptyTuple, "is empty tuple");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsTrue (tlf.Signature.ReturnType.IsEmptyTuple, "is empty tuple");
var ct = tlf.Signature.Parameters as SwiftClassType;
- Assert.IsNotNull (ct, "ct");
- Assert.IsTrue (ct.EntityKind == MemberNesting.Enum, "is enum");
- Assert.AreEqual ("First", ct.ClassName.Terminus.Name, "is First");
+ ClassicAssert.IsNotNull (ct, "ct");
+ ClassicAssert.IsTrue (ct.EntityKind == MemberNesting.Enum, "is enum");
+ ClassicAssert.AreEqual ("First", ct.ClassName.Terminus.Name, "is First");
}
[Test]
@@ -480,8 +481,8 @@ public void DemcomposeCConventionCall ()
{
var func = "_$s17unitHelpFrawework12callSomeFuncyyyyXCF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.IsTrue (tlf.Signature.Parameters is SwiftCFunctionPointerType, "not a c function pointer type");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsTrue (tlf.Signature.Parameters is SwiftCFunctionPointerType, "not a c function pointer type");
}
[Test]
@@ -490,14 +491,14 @@ public void DecomposeUnsafePointer ()
// NB: this function used UnsafePointer<()> which is deprecated.
var func = "_$s17unitHelpFrawework19setMonty_xam_vtable_3uvtyAA0f5_sub_E0V_SPyytGtF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
SwiftType bft = tlf.Signature.GetParameter (1);
- Assert.IsNotNull (bft, "bft");
- Assert.IsTrue (bft is SwiftBoundGenericType, "is SwiftBoundGeneric");
+ ClassicAssert.IsNotNull (bft, "bft");
+ ClassicAssert.IsTrue (bft is SwiftBoundGenericType, "is SwiftBoundGeneric");
var gen = bft as SwiftBoundGenericType;
SwiftClassType baseType = gen.BaseType as SwiftClassType;
- Assert.NotNull (baseType, "baseType");
- Assert.AreEqual ("UnsafePointer", baseType.ClassName.Terminus.Name, "UnsafePointer");
+ ClassicAssert.NotNull (baseType, "baseType");
+ ClassicAssert.AreEqual ("UnsafePointer", baseType.ClassName.Terminus.Name, "UnsafePointer");
}
@@ -506,8 +507,8 @@ public void DemcomposeReturnsInt64 ()
{
var func = "_$s17unitHelpFrawework5MontyC3vals5Int64VyF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.IsTrue (tlf.Signature.ReturnType is SwiftClassType, "is swift class type");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsTrue (tlf.Signature.ReturnType is SwiftClassType, "is swift class type");
}
[Test]
@@ -515,11 +516,11 @@ public void DecomposeProtocol ()
{
var func = "_$s17unitHelpFrawework11ThisIsaFunc_1xs5Int64VAA7MyProto_p_AEtF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.IsTrue (tlf.Signature.ParameterCount == 2, "parameter count");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsTrue (tlf.Signature.ParameterCount == 2, "parameter count");
var prot = tlf.Signature.GetParameter (0) as SwiftClassType;
- Assert.IsNotNull (prot, "prot");
- Assert.AreEqual (MemberNesting.Protocol, prot.EntityKind, "is protocol");
+ ClassicAssert.IsNotNull (prot, "prot");
+ ClassicAssert.AreEqual (MemberNesting.Protocol, prot.EntityKind, "is protocol");
}
@@ -528,10 +529,10 @@ public void DecomposeSimpleGeneric ()
{
var func = "_$s17unitHelpFrawework3foo_1b1c1dyx_S3itlF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (4, tlf.Signature.ParameterCount, "parameter count");
- Assert.IsTrue (tlf.Signature.ContainsGenericParameters, "contains generic parameters");
- Assert.AreEqual (1, tlf.Signature.GenericArguments.Count (), "generic arguments count");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (4, tlf.Signature.ParameterCount, "parameter count");
+ ClassicAssert.IsTrue (tlf.Signature.ContainsGenericParameters, "contains generic parameters");
+ ClassicAssert.AreEqual (1, tlf.Signature.GenericArguments.Count (), "generic arguments count");
}
[Test]
@@ -539,10 +540,10 @@ public void DecomposeMultiGeneric ()
{
var func = "_$s17unitHelpFrawework3foo1a1b1c1dyx_q_q0_q1_tr2_lF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (4, tlf.Signature.ParameterCount, "parameter count");
- Assert.IsTrue (tlf.Signature.ContainsGenericParameters, "contains generic parameters");
- Assert.AreEqual (4, tlf.Signature.GenericArguments.Count (), "generic argument count");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (4, tlf.Signature.ParameterCount, "parameter count");
+ ClassicAssert.IsTrue (tlf.Signature.ContainsGenericParameters, "contains generic parameters");
+ ClassicAssert.AreEqual (4, tlf.Signature.GenericArguments.Count (), "generic argument count");
}
[Test]
@@ -550,8 +551,8 @@ public void DecomposeMetadataPattern ()
{
var func = "_$s17unitHelpFrawework3FooCMP";
var gmp = Decomposer.Decompose (func, false) as TLGenericMetadataPattern;
- Assert.IsNotNull (gmp, "gmp");
- Assert.AreEqual ("unitHelpFrawework.Foo", gmp.Class.ClassName.ToFullyQualifiedName (true), "classname");
+ ClassicAssert.IsNotNull (gmp, "gmp");
+ ClassicAssert.AreEqual ("unitHelpFrawework.Foo", gmp.Class.ClassName.ToFullyQualifiedName (true), "classname");
}
@@ -561,9 +562,9 @@ public void DecomposeStaticProp ()
var func = "_$s17unitHelpFrawework11aFinalClassC11aStaticPropSbvpZ";
var tlv = Decomposer.Decompose (func, false) as TLVariable;
- Assert.IsNotNull (tlv, "tlv");
- Assert.IsTrue (tlv.IsStatic, "IsStatic");
- Assert.IsNotNull (tlv.Class, "Class");
+ ClassicAssert.IsNotNull (tlv, "tlv");
+ ClassicAssert.IsTrue (tlv.IsStatic, "IsStatic");
+ ClassicAssert.IsNotNull (tlv.Class, "Class");
}
[Test]
@@ -571,9 +572,9 @@ public void DecomposeMultiProtoConstraints ()
{
var func = "_$s17unitHelpFrawework16xamarin_FooDuppy3foo1ayAA0E0CyxG_xtAA6DownerRzAA5UpperRzlF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (1, tlf.Signature.GenericArguments.Count, "genric argument count");
- Assert.AreEqual (2, tlf.Signature.GenericArguments [0].Constraints.Count, "constraints count");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (1, tlf.Signature.GenericArguments.Count, "genric argument count");
+ ClassicAssert.AreEqual (2, tlf.Signature.GenericArguments [0].Constraints.Count, "constraints count");
}
[Test]
@@ -581,13 +582,13 @@ public void DecomposeVariableInitializer ()
{
var func = "_$s17unitHelpFrawework5MontyC3valSbvpfi";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
SwiftInitializerType sit = tlf.Signature as SwiftInitializerType;
- Assert.IsNotNull (sit, "sit");
- Assert.AreEqual ("val", sit.Name.Name, "name equal");
+ ClassicAssert.IsNotNull (sit, "sit");
+ ClassicAssert.AreEqual ("val", sit.Name.Name, "name equal");
SwiftBuiltInType bit = sit.ReturnType as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
}
[Test]
@@ -595,7 +596,7 @@ public void DecomposeUnsafeRawPointer ()
{
var func = "_$s17unitHelpFrawework3FooSVyF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
}
[Test]
@@ -603,8 +604,8 @@ public void DecomposeThrowingFunction ()
{
var func = "_$s17unitHelpFrawework7throwIt7doThrowSiSb_tKF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.IsTrue (tlf.Signature.CanThrow, "CanThrow");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsTrue (tlf.Signature.CanThrow, "CanThrow");
}
[Test]
@@ -612,10 +613,10 @@ public void DecomposeVariadicParameter()
{
var func = "_$s17unitHelpFrawework5AKLog8fullname4file4line6othersySS_SSSiypdtF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (4, tlf.Signature.ParameterCount, "ParameterCount");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (4, tlf.Signature.ParameterCount, "ParameterCount");
var arrtype = tlf.Signature.GetParameter (3) as SwiftBoundGenericType;
- Assert.IsNotNull (arrtype, "arrtype");
+ ClassicAssert.IsNotNull (arrtype, "arrtype");
}
@@ -625,10 +626,10 @@ public void DecomposerDidSet()
{
var func = "_$s17unitHelpFrawework20AKPinkNoiseAudioUnitC9amplitudeSivW";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.AreEqual (PropertyType.DidSet, prop.PropertyType, "PropertyType");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.AreEqual (PropertyType.DidSet, prop.PropertyType, "PropertyType");
}
[Test]
@@ -637,10 +638,10 @@ public void DecomposerMaterializer ()
{
var func = "";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.AreEqual (PropertyType.Materializer, prop.PropertyType, "PropertyType");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.AreEqual (PropertyType.Materializer, prop.PropertyType, "PropertyType");
}
[Test]
@@ -649,10 +650,10 @@ public void DecomposerMaterializerWithPrivateName ()
{
var func = "";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.AreEqual (PropertyType.Materializer, prop.PropertyType, "PropertyType");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.AreEqual (PropertyType.Materializer, prop.PropertyType, "PropertyType");
}
[Test]
@@ -660,10 +661,10 @@ public void DecomposeWillSet()
{
var func = "_$s17unitHelpFrawework20AKPinkNoiseAudioUnitC9amplitudeSivw";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.AreEqual (PropertyType.WillSet, prop.PropertyType, "PropertyType");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.AreEqual (PropertyType.WillSet, prop.PropertyType, "PropertyType");
}
[Test]
@@ -671,8 +672,8 @@ public void DecomposeFieldOffset ()
{
var func = "_$s17unitHelpFrawework24AKVariableDelayAudioUnitC12rampDurationSdvpWvd";
var tlf = Decomposer.Decompose (func, false) as TLFieldOffset;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual ("rampDuration", tlf.Identifier.Name, "name");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual ("rampDuration", tlf.Identifier.Name, "name");
}
[Test]
@@ -680,9 +681,9 @@ public void DecomposeConstructorArgInitializer()
{
var func = "_$s17unitHelpFrawework10AKMIDINodeC10enableMIDI4port4nameys6UInt32V_SStFfA0_";
var init = Decomposer.Decompose (func, false) as TLDefaultArgumentInitializer;
- Assert.IsNotNull (init, "init");
- Assert.AreEqual (1, init.ArgumentIndex, "argument index");
- Assert.IsTrue (init.Signature is SwiftUncurriedFunctionType, "uncurried function");
+ ClassicAssert.IsNotNull (init, "init");
+ ClassicAssert.AreEqual (1, init.ArgumentIndex, "argument index");
+ ClassicAssert.IsTrue (init.Signature is SwiftUncurriedFunctionType, "uncurried function");
}
[Test]
@@ -690,9 +691,9 @@ public void DecomposeFuncArgInitializer ()
{
var func = "_$s17unitHelpFrawework10AKMIDINodeC10enableMIDI4port4nameys6UInt32V_SStFfA_";
var init = Decomposer.Decompose (func, false) as TLDefaultArgumentInitializer;
- Assert.IsNotNull (init, "init");
- Assert.AreEqual (0, init.ArgumentIndex, "argument index");
- Assert.IsTrue (init.Signature is SwiftUncurriedFunctionType, "uncurried function");
+ ClassicAssert.IsNotNull (init, "init");
+ ClassicAssert.AreEqual (0, init.ArgumentIndex, "argument index");
+ ClassicAssert.IsTrue (init.Signature is SwiftUncurriedFunctionType, "uncurried function");
}
[Test]
@@ -700,9 +701,9 @@ public void DecomposeFuncArgInitializer1 ()
{
var func = "_$s17unitHelpFrawework10AKMIDINodeC11createError33_3D85A716E8AC30D62D97E78DB643A23DLL7message4codeSo7NSErrorCSS_SitFfA0_";
var init = Decomposer.Decompose (func, false) as TLDefaultArgumentInitializer;
- Assert.IsNotNull (init, "init");
- Assert.AreEqual (1, init.ArgumentIndex, "argument index");
- Assert.IsTrue (init.Signature is SwiftUncurriedFunctionType, "uncurried function");
+ ClassicAssert.IsNotNull (init, "init");
+ ClassicAssert.AreEqual (1, init.ArgumentIndex, "argument index");
+ ClassicAssert.IsTrue (init.Signature is SwiftUncurriedFunctionType, "uncurried function");
}
[Test]
@@ -710,8 +711,8 @@ public void DecomposeMetaclass ()
{
var func = "_$s8AudioKit11AKOperationCMm";
var mc = Decomposer.Decompose (func, false) as TLMetaclass;
- Assert.IsNotNull (mc, "mc");
- Assert.AreEqual ("AudioKit.AKOperation", mc.Class.ClassName.ToFullyQualifiedName(true));
+ ClassicAssert.IsNotNull (mc, "mc");
+ ClassicAssert.AreEqual ("AudioKit.AKOperation", mc.Class.ClassName.ToFullyQualifiedName(true));
}
@@ -720,9 +721,9 @@ public void DecomposePrivateNameProp ()
{
var func = "_$s17unitHelpFrawework11AKPinkNoiseC10internalAU33_3D85A716E8AC30D62D97E78DB643A23DLLSivg";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop.PrivateName, "PrivateName");
+ ClassicAssert.IsNotNull (prop.PrivateName, "PrivateName");
}
[Test]
@@ -730,7 +731,7 @@ public void DecomposeUnsafeMutableAddressor()
{
var func = "_$s17unitHelpFrawework10AKBalancerC20ComponentDescriptionSSvau";
var tlf = Decomposer.Decompose (func, false) as TLUnsafeMutableAddressor;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
}
[Test]
@@ -738,10 +739,10 @@ public void DecomposeStaticVariable ()
{
var func = "_$s8AudioKit10AKBalancerC20ComponentDescriptionSSvpZ";
var tlf = Decomposer.Decompose (func, false) as TLVariable;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual ("AudioKit.AKBalancer", tlf.Class.ClassName.ToFullyQualifiedName (true));
- Assert.AreEqual ("ComponentDescription", tlf.Name.Name);
- Assert.IsTrue (tlf.IsStatic);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual ("AudioKit.AKBalancer", tlf.Class.ClassName.ToFullyQualifiedName (true));
+ ClassicAssert.AreEqual ("ComponentDescription", tlf.Name.Name);
+ ClassicAssert.IsTrue (tlf.IsStatic);
}
[Test]
@@ -749,8 +750,8 @@ public void DecomposeVariable1 ()
{
var func = "_$s17unitHelpFrawework12callbackUgenSo8NSObjectCvp";
var tlf = Decomposer.Decompose (func, false) as TLVariable;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual ("callbackUgen", tlf.Name.Name, "name match");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual ("callbackUgen", tlf.Name.Name, "name match");
}
[Test]
@@ -758,7 +759,7 @@ public void DecomposeUnsafeMutableAddressor1 ()
{
var func = "_$s17unitHelpFrawework10AKDurationV16secondsPerMinuteSivau";
var tlf = Decomposer.Decompose (func, false) as TLUnsafeMutableAddressor;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
}
[Test]
@@ -766,7 +767,7 @@ public void DecomposeUnsafeMutableAddressor2 ()
{
var func = "_$s17unitHelpFrawework10AKMetalBarV14scanSpeedRangeSNySdGvau";
var tlf = Decomposer.Decompose (func, false) as TLUnsafeMutableAddressor;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
}
[Test]
@@ -774,7 +775,7 @@ public void DecomposeUnsafeMutableAddressor3 ()
{
var func = "_$s17unitHelpFrawework10AKMetalBarV12pregainRangeSNySdGvau";
var tlf = Decomposer.Decompose (func, false) as TLUnsafeMutableAddressor;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
}
[Test]
@@ -782,8 +783,8 @@ public void DecomposeCurryThunk ()
{
var func = "_$s17unitHelpFrawework13AKAudioPlayerV25internalCompletionHandler33_3D85A716E8AC30D62D97E78DB643A23DLLyyFTc";
var tlf = Decomposer.Decompose (func, false) as TLThunk;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (ThunkType.Curry, tlf.Thunk, "curry thunk");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (ThunkType.Curry, tlf.Thunk, "curry thunk");
}
@@ -792,12 +793,12 @@ public void DecomposeVarArgs()
{
var func = "_$s17unitHelpFrawework4JSONC17dictionaryLiteralACSS_yptd_tcfC";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (1, tlf.Signature.ParameterCount, "parameter count");
- Assert.IsNotNull (tlf.Signature.Parameters, "parameters");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (1, tlf.Signature.ParameterCount, "parameter count");
+ ClassicAssert.IsNotNull (tlf.Signature.Parameters, "parameters");
var bgt = tlf.Signature.GetParameter (0) as SwiftBoundGenericType;
- Assert.IsNotNull(bgt, "as bound generic");
- Assert.IsTrue (bgt.IsVariadic, "variadic");
+ ClassicAssert.IsNotNull(bgt, "as bound generic");
+ ClassicAssert.IsTrue (bgt.IsVariadic, "variadic");
}
@@ -806,13 +807,13 @@ public void DecomposeNestedGenerics()
{
var func = "_$s17unitHelpFrawework3FooC3BarC4doIt1a1b1cyx_qd__qd0__tlF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (3, tlf.Signature.ParameterCount, "parameter count");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (3, tlf.Signature.ParameterCount, "parameter count");
for (int i = 0; i < tlf.Signature.ParameterCount; i++) {
var genRef = tlf.Signature.GetParameter (i) as SwiftGenericArgReferenceType;
- Assert.IsNotNull (genRef, "genRef");
- Assert.AreEqual (i, genRef.Depth, "depth");
- Assert.AreEqual (0, genRef.Index, "index");
+ ClassicAssert.IsNotNull (genRef, "genRef");
+ ClassicAssert.AreEqual (i, genRef.Depth, "depth");
+ ClassicAssert.AreEqual (0, genRef.Index, "index");
}
}
@@ -821,14 +822,14 @@ public void DecomposeExtensionPropGetter ()
{
var func = "_$sSd17unitHelpFraweworkE11millisecondSdvg";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.IsTrue (tlf.Signature.IsExtension, "Expected extension");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsTrue (tlf.Signature.IsExtension, "Expected extension");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "Expected property");
+ ClassicAssert.IsNotNull (prop, "Expected property");
var extensionOn = prop.ExtensionOn as SwiftBuiltInType;
- Assert.IsNotNull (extensionOn, "Expected a swift built-in type for the extension on");
- Assert.AreEqual (CoreCompoundType.Scalar, extensionOn.Type, "Expected a scalar");
- Assert.AreEqual (CoreBuiltInType.Double, extensionOn.BuiltInType, "Expected a double");
+ ClassicAssert.IsNotNull (extensionOn, "Expected a swift built-in type for the extension on");
+ ClassicAssert.AreEqual (CoreCompoundType.Scalar, extensionOn.Type, "Expected a scalar");
+ ClassicAssert.AreEqual (CoreBuiltInType.Double, extensionOn.BuiltInType, "Expected a double");
}
@@ -837,14 +838,14 @@ public void DecomposeExtensionFunc ()
{
var func = "_$sSd4NoneE7printeryyF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.IsTrue (tlf.Signature.IsExtension, "Expected extension");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsTrue (tlf.Signature.IsExtension, "Expected extension");
var fn = tlf.Signature as SwiftFunctionType;
- Assert.IsNotNull (fn, "Expected function");
+ ClassicAssert.IsNotNull (fn, "Expected function");
var extensionOn = fn.ExtensionOn as SwiftBuiltInType;
- Assert.IsNotNull (extensionOn, "Expected a swift built-in type for the extension on");
- Assert.AreEqual (CoreCompoundType.Scalar, extensionOn.Type, "Expected a scalar");
- Assert.AreEqual (CoreBuiltInType.Double, extensionOn.BuiltInType, "Expected a double");
+ ClassicAssert.IsNotNull (extensionOn, "Expected a swift built-in type for the extension on");
+ ClassicAssert.AreEqual (CoreCompoundType.Scalar, extensionOn.Type, "Expected a scalar");
+ ClassicAssert.AreEqual (CoreBuiltInType.Double, extensionOn.BuiltInType, "Expected a double");
}
[Test]
@@ -852,9 +853,9 @@ public void DecomposeGenericWithConstraints ()
{
var func = "_$s17unitHelpFrawework03ChaD0V6reseed4withyx_tSTRzs6UInt32V7ElementRtzlF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "Failed to decompose function");
- Assert.AreEqual (1, tlf.Signature.GenericArguments.Count, "Expected 1 generic argument");
- Assert.AreEqual (2, tlf.Signature.GenericArguments [0].Constraints.Count, "Expected 2 generic constraints");
+ ClassicAssert.IsNotNull (tlf, "Failed to decompose function");
+ ClassicAssert.AreEqual (1, tlf.Signature.GenericArguments.Count, "Expected 1 generic argument");
+ ClassicAssert.AreEqual (2, tlf.Signature.GenericArguments [0].Constraints.Count, "Expected 2 generic constraints");
}
@@ -863,11 +864,11 @@ public void DecomposeUsafeMutableAddressor1 ()
{
var func = "_$s17unitHelpFrawework20EasingFunctionLineary12CoreGraphics7CGFloatVAEcvau";
var tlf = Decomposer.Decompose (func, false) as TLUnsafeMutableAddressor;
- Assert.IsNotNull (tlf, "Failed to decompose function");
- Assert.IsNotNull (tlf.OfType, "Expected non-null 'ofType'");
- Assert.AreEqual ("EasingFunctionLinear", tlf.Name.Name, $"Incorrect name {tlf.Name.Name}");
+ ClassicAssert.IsNotNull (tlf, "Failed to decompose function");
+ ClassicAssert.IsNotNull (tlf.OfType, "Expected non-null 'ofType'");
+ ClassicAssert.AreEqual ("EasingFunctionLinear", tlf.Name.Name, $"Incorrect name {tlf.Name.Name}");
var funcType = tlf.OfType as SwiftFunctionType;
- Assert.IsNotNull (funcType, "null function type");
+ ClassicAssert.IsNotNull (funcType, "null function type");
}
[Test]
@@ -875,11 +876,11 @@ public void DecomposeSubscriptGetter ()
{
var func = "_$s17unitHelpFrawework3FooCyS2icig";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsTrue (prop.IsSubscript, "is subscript");
- Assert.AreEqual (PropertyType.Getter, prop.PropertyType, "getter");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsTrue (prop.IsSubscript, "is subscript");
+ ClassicAssert.AreEqual (PropertyType.Getter, prop.PropertyType, "getter");
}
[Test]
@@ -887,11 +888,11 @@ public void DecomposeSubscriptSetter ()
{
var func = "_$s17unitHelpFrawework3FooCyS2icis";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsTrue (prop.IsSubscript, "is subscript");
- Assert.AreEqual (PropertyType.Setter, prop.PropertyType, "setter");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsTrue (prop.IsSubscript, "is subscript");
+ ClassicAssert.AreEqual (PropertyType.Setter, prop.PropertyType, "setter");
}
[Test]
@@ -899,11 +900,11 @@ public void DecomposeSubscriptModifier ()
{
var func = "_$s17unitHelpFrawework3FooCyS2iciM";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsTrue (prop.IsSubscript, "is subscript");
- Assert.AreEqual (PropertyType.ModifyAccessor, prop.PropertyType, "setter");
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsTrue (prop.IsSubscript, "is subscript");
+ ClassicAssert.AreEqual (PropertyType.ModifyAccessor, prop.PropertyType, "setter");
}
[Test]
@@ -911,10 +912,10 @@ public void DecomposeNominalTypeDescriptorClass ()
{
var func = "_$s17unitHelpFrawework3FooCMn";
var tlf = Decomposer.Decompose (func, false) as TLNominalTypeDescriptor;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var className = tlf.Class.ClassName.ToFullyQualifiedName (true);
- Assert.AreEqual ("unitHelpFrawework.Foo", className, "className");
- Assert.IsTrue (tlf.Class.IsClass, "IsClass");
+ ClassicAssert.AreEqual ("unitHelpFrawework.Foo", className, "className");
+ ClassicAssert.IsTrue (tlf.Class.IsClass, "IsClass");
}
[Test]
@@ -922,10 +923,10 @@ public void DecomposeNominalTypeDescriptorStruct ()
{
var func = "_$s17unitHelpFrawework3BarVMn";
var tlf = Decomposer.Decompose (func, false) as TLNominalTypeDescriptor;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var className = tlf.Class.ClassName.ToFullyQualifiedName (true);
- Assert.AreEqual ("unitHelpFrawework.Bar", className, "className");
- Assert.IsTrue (tlf.Class.IsStruct, "IsStruct");
+ ClassicAssert.AreEqual ("unitHelpFrawework.Bar", className, "className");
+ ClassicAssert.IsTrue (tlf.Class.IsStruct, "IsStruct");
}
[Test]
@@ -933,10 +934,10 @@ public void DecomposeNominalTypeDescriptorEnum ()
{
var func = "_$s17unitHelpFrawework3BazOMn";
var tlf = Decomposer.Decompose (func, false) as TLNominalTypeDescriptor;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var className = tlf.Class.ClassName.ToFullyQualifiedName (true);
- Assert.AreEqual ("unitHelpFrawework.Baz", className, "className");
- Assert.IsTrue (tlf.Class.IsEnum, "IsEnum");
+ ClassicAssert.AreEqual ("unitHelpFrawework.Baz", className, "className");
+ ClassicAssert.IsTrue (tlf.Class.IsEnum, "IsEnum");
}
[Test]
@@ -944,10 +945,10 @@ public void DecomposeProtocolTypeDescriptor ()
{
var func = "_$s17unitHelpFrawework4UppyMp";
var tlf = Decomposer.Decompose (func, false) as TLProtocolTypeDescriptor;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var className = tlf.Class.ClassName.ToFullyQualifiedName (true);
- Assert.AreEqual ("unitHelpFrawework.Uppy", className, "className");
- Assert.IsTrue (tlf.Class.IsProtocol, "IsProtocol");
+ ClassicAssert.AreEqual ("unitHelpFrawework.Uppy", className, "className");
+ ClassicAssert.IsTrue (tlf.Class.IsProtocol, "IsProtocol");
}
[Test]
@@ -955,12 +956,12 @@ public void DecomposeProtocolWitnessTable ()
{
var func = "_$s17unitHelpFrawework3FooCAA4UppyAAWP";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var sig = tlf.Signature as SwiftWitnessTableType;
- Assert.IsNotNull (sig, "sig");
- Assert.AreEqual (WitnessType.Protocol, sig.WitnessType, "is protocol");
+ ClassicAssert.IsNotNull (sig, "sig");
+ ClassicAssert.AreEqual (WitnessType.Protocol, sig.WitnessType, "is protocol");
var className = sig.ProtocolType.ClassName.ToFullyQualifiedName (true);
- Assert.AreEqual ("unitHelpFrawework.Uppy", className, "protocol name");
+ ClassicAssert.AreEqual ("unitHelpFrawework.Uppy", className, "protocol name");
}
[Test]
@@ -968,14 +969,14 @@ public void DecomposeValueWitnessTable ()
{
var func = "_$s17unitHelpFrawework7AStructVWV";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var sig = tlf.Signature as SwiftWitnessTableType;
- Assert.IsNotNull (sig, "sig");
- Assert.AreEqual (WitnessType.Value, sig.WitnessType, "is value type");
+ ClassicAssert.IsNotNull (sig, "sig");
+ ClassicAssert.AreEqual (WitnessType.Value, sig.WitnessType, "is value type");
var classType = sig.UncurriedParameter as SwiftClassType;
- Assert.IsNotNull (classType, "classType");
+ ClassicAssert.IsNotNull (classType, "classType");
var className = classType.ClassName.ToFullyQualifiedName (true);
- Assert.AreEqual ("unitHelpFrawework.AStruct", className);
+ ClassicAssert.AreEqual ("unitHelpFrawework.AStruct", className);
}
[Test]
@@ -983,15 +984,15 @@ public void DecomposeMethodDescriptor ()
{
var func = "_$s8itsAFive3BarC3foo1aS2i_tFTq";
var tlf = Decomposer.Decompose (func, false) as TLMethodDescriptor;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual ("foo", tlf.Signature.Name.Name, "name mismatch");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual ("foo", tlf.Signature.Name.Name, "name mismatch");
var builtInType = tlf.Signature.ReturnType as SwiftBuiltInType;
- Assert.IsNotNull (builtInType, "return builtInType");
- Assert.AreEqual (CoreBuiltInType.Int, builtInType.BuiltInType, "return type mismatch");
+ ClassicAssert.IsNotNull (builtInType, "return builtInType");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, builtInType.BuiltInType, "return type mismatch");
builtInType = tlf.Signature.GetParameter (0) as SwiftBuiltInType;
- Assert.IsNotNull (builtInType, "parameter builtInType");
- Assert.AreEqual (CoreBuiltInType.Int, builtInType.BuiltInType, "parameter type mismatch");
- Assert.AreEqual ("a", builtInType.Name.Name, "parameter name mismatch");
+ ClassicAssert.IsNotNull (builtInType, "parameter builtInType");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, builtInType.BuiltInType, "parameter type mismatch");
+ ClassicAssert.AreEqual ("a", builtInType.Name.Name, "parameter name mismatch");
}
[Test]
@@ -999,8 +1000,8 @@ public void DecomposeModuleDescriptor ()
{
var func = "_$s8itsAFiveMXM";
var tlf = Decomposer.Decompose (func, false) as TLModuleDescriptor;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual ("itsAFive", tlf.Module.Name);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual ("itsAFive", tlf.Module.Name);
}
@@ -1009,11 +1010,11 @@ public void DecomposePropertyDescriptor ()
{
var func = "_$s8itsAFive3FooC1xSivpMV";
var tlf = Decomposer.Decompose (func, false) as TLPropertyDescriptor;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual ("x", tlf.Name.Name);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual ("x", tlf.Name.Name);
var ofType = tlf.OfType as SwiftBuiltInType;
- Assert.IsNotNull (ofType, "null ofType");
- Assert.AreEqual (CoreBuiltInType.Int, ofType.BuiltInType);
+ ClassicAssert.IsNotNull (ofType, "null ofType");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, ofType.BuiltInType);
}
@@ -1022,11 +1023,11 @@ public void DecomposeReflectionMetadataDescriptor ()
{
var func = "_$s8itsAFive2E2OMF";
var tlf = Decomposer.Decompose (func, false) as TLMetadataDescriptor;
- Assert.IsNotNull (tlf, "tlf");
- Assert.IsFalse (tlf.IsBuiltIn, "IsBuiltIn");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsFalse (tlf.IsBuiltIn, "IsBuiltIn");
var ct = tlf.OfType as SwiftClassType;
- Assert.IsNotNull (ct, "not a class");
- Assert.AreEqual ("itsAFive.E2", ct.ClassName.ToFullyQualifiedName ());
+ ClassicAssert.IsNotNull (ct, "not a class");
+ ClassicAssert.AreEqual ("itsAFive.E2", ct.ClassName.ToFullyQualifiedName ());
}
@@ -1035,11 +1036,11 @@ public void DecomposeReflectionBuiltInMetadataDescriptor ()
{
var func = "_$s8itsAFive2E2OMB";
var tlf = Decomposer.Decompose (func, false) as TLMetadataDescriptor;
- Assert.IsNotNull (tlf, "tlf");
- Assert.IsTrue (tlf.IsBuiltIn, "IsBuiltIn");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsTrue (tlf.IsBuiltIn, "IsBuiltIn");
var ct = tlf.OfType as SwiftClassType;
- Assert.IsNotNull (ct, "not a class");
- Assert.AreEqual ("itsAFive.E2", ct.ClassName.ToFullyQualifiedName ());
+ ClassicAssert.IsNotNull (ct, "not a class");
+ ClassicAssert.AreEqual ("itsAFive.E2", ct.ClassName.ToFullyQualifiedName ());
}
[Test]
@@ -1047,7 +1048,7 @@ public void DecomposeProtocolConformanceDescriptor ()
{
var func = "_$sSayxG5Macaw12InterpolableABMc";
var tlf = Decomposer.Decompose (func, false) as TLProtocolConformanceDescriptor;
- Assert.IsNotNull (tlf);
+ ClassicAssert.IsNotNull (tlf);
}
@@ -1056,13 +1057,13 @@ public void DecomposeExistentialMetatype ()
{
var func = "_$s24ProtocolConformanceTests14blindAssocFuncypXpyF";
var tlf = Decomposer.Decompose (func, false) as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
var returnType = tlf.Signature.ReturnType as SwiftExistentialMetaType;
- Assert.IsNotNull (returnType, "not an existential metatype");
+ ClassicAssert.IsNotNull (returnType, "not an existential metatype");
var protoList = returnType.Protocol;
- Assert.IsNotNull (protoList, "no protocol list");
+ ClassicAssert.IsNotNull (protoList, "no protocol list");
var proto = protoList.Protocols [0];
- Assert.AreEqual ("Swift.Any", proto.ClassName.ToFullyQualifiedName (), "class name mismatch");
+ ClassicAssert.AreEqual ("Swift.Any", proto.ClassName.ToFullyQualifiedName (), "class name mismatch");
}
}
}
diff --git a/tests/tom-swifty-test/SwiftReflector/GenericFunctionTests.cs b/tests/tom-swifty-test/SwiftReflector/GenericFunctionTests.cs
index be969cc2..b6c08915 100644
--- a/tests/tom-swifty-test/SwiftReflector/GenericFunctionTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/GenericFunctionTests.cs
@@ -15,7 +15,7 @@
using System.Linq;
using Dynamo.CSLang;
using System.Text;
-
+using NUnit.Framework.Legacy;
namespace SwiftReflector {
[TestFixture]
@@ -471,7 +471,7 @@ public void WrapGenClassConstraintIncorrectUsage ()
var exeOutFilename = provider.UniquePath (null, "CSWrap", "exe");
CodeWriter.WriteToFile (csOutFilename, csfile);
- Assert.Throws (() => {
+ ClassicAssert.Throws (() => {
Compiler.CSCompile (provider.DirectoryPath, Directory.GetFiles (provider.DirectoryPath, "*.cs"), exeOutFilename);
});
}
@@ -523,7 +523,7 @@ public void WrapGenVirtClassConstraintIncorrectUsage ()
CodeWriter.WriteToFile (csOutFilename, csfile);
- Assert.Throws (() => {
+ ClassicAssert.Throws (() => {
Compiler.CSCompile (provider.DirectoryPath, Directory.GetFiles (provider.DirectoryPath, "*.cs"), exeOutFilename);
});
}
@@ -620,7 +620,7 @@ public void WrapGenClassProtocolConstraintIncorrectUsage ()
CodeWriter.WriteToFile (csOutFilename, csfile);
- Assert.Throws (() => {
+ ClassicAssert.Throws (() => {
Compiler.CSCompile (provider.DirectoryPath, Directory.GetFiles (provider.DirectoryPath, "*.cs"), csOutFilename);
});
}
@@ -703,12 +703,12 @@ public void WrapGenClassMultiProtocolConstraintIncorrectUsage ()
CodeWriter.WriteToFile (csOutFilename, csfile);
Compiler.CSCompile (provider.DirectoryPath, Directory.GetFiles (provider.DirectoryPath, "*.cs"), exeFilename, platform: PlatformName.macOS);
- Exception e = Assert.Throws (() => {
+ Exception e = ClassicAssert.Throws (() => {
TestRunning.CopyTestReferencesTo (provider.DirectoryPath);
string output = Compiler.RunWithMono (exeFilename, provider.DirectoryPath, platform: PlatformName.macOS);
- Assert.AreEqual ("1\n", output);
+ ClassicAssert.AreEqual ("1\n", output);
});
- Assert.True (e.Message.Contains ("NotSupportedException"));
+ ClassicAssert.True (e.Message.Contains ("NotSupportedException"));
}
}
@@ -1191,7 +1191,7 @@ string WrapPropertyBag (string cstype, string toAdd)
[Test]
public void TestPropBag ()
{
- Assert.AreEqual ("", WrapPropertyBag ("nint", "5"));
+ ClassicAssert.AreEqual ("", WrapPropertyBag ("nint", "5"));
}
[Test]
diff --git a/tests/tom-swifty-test/SwiftReflector/MetatypeTests.cs b/tests/tom-swifty-test/SwiftReflector/MetatypeTests.cs
index d553280f..d26e67f0 100644
--- a/tests/tom-swifty-test/SwiftReflector/MetatypeTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/MetatypeTests.cs
@@ -18,6 +18,7 @@
using System.CodeDom;
using System.Reflection;
using Dynamo.CSLang;
+using NUnit.Framework.Legacy;
namespace SwiftReflector {
[TestFixture]
@@ -171,7 +172,7 @@ public static void Main (string[] args)
TestRunning.CopyTestReferencesTo (temp.DirectoryPath);
string output = Compiler.RunWithMono (Path.Combine (temp.DirectoryPath, "TestIt.exe"), temp.DirectoryPath, platform: PlatformName.macOS);
- Assert.AreEqual (expected, output);
+ ClassicAssert.AreEqual (expected, output);
var typeBasedClassName = typeName.Replace ('.', '_');
string tsource = $@"using System;
@@ -229,7 +230,7 @@ public static void Main (string[] args)
TestRunning.CopyTestReferencesTo (temp.DirectoryPath);
var output = TestRunning.Execute (temp.DirectoryPath, "TestIt.exe", PlatformName.macOS);
- Assert.AreEqual (expected, output);
+ ClassicAssert.AreEqual (expected, output);
var typeBasedClassName = typeName.Replace ('.', '_');
var tsource = $@"using System;
@@ -287,7 +288,7 @@ public static void Main (string[] args)
TestRunning.CopyTestReferencesTo (temp.DirectoryPath);
var output = Compiler.RunWithMono (Path.Combine (temp.DirectoryPath, "TestIt.exe"), temp.DirectoryPath, platform: PlatformName.macOS);
- Assert.AreEqual (expected, output);
+ ClassicAssert.AreEqual (expected, output);
var typeBasedClassName = typeName.Replace('.', '_');
var tsource = $@"using System;
@@ -376,7 +377,7 @@ public static void Main (string[] args)
TestRunning.CopyTestReferencesTo (temp.DirectoryPath);
string output = Compiler.RunWithMono (Path.Combine (temp.DirectoryPath, "TestIt.exe"), temp.DirectoryPath);
- Assert.AreEqual (expected, output);
+ ClassicAssert.AreEqual (expected, output);
}
}
diff --git a/tests/tom-swifty-test/SwiftReflector/NewClassCompilerTests.cs b/tests/tom-swifty-test/SwiftReflector/NewClassCompilerTests.cs
index 029d56aa..7aee415c 100644
--- a/tests/tom-swifty-test/SwiftReflector/NewClassCompilerTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/NewClassCompilerTests.cs
@@ -9,6 +9,7 @@
using Dynamo;
using Dynamo.CSLang;
using NUnit.Framework;
+using NUnit.Framework.Legacy;
using SwiftReflector.IOUtils;
using SwiftReflector.TypeMapping;
using tomwiftytest;
@@ -1116,8 +1117,8 @@ public void ImportBindingSmokeTest (string swiftCode, string swiftName, string n
List typeDatabasePaths = new List { Path.Combine (libProvider.DirectoryPath, "bindings") };
TypeMapper typeMapper = new TypeMapper (typeDatabasePaths, UnicodeMapper.Default);
var entity = typeMapper.TypeDatabase.EntityForSwiftName (swiftName);
- Assert.AreEqual (ns, entity.SharpNamespace);
- Assert.AreEqual (csharpName, entity.SharpTypeName);
+ ClassicAssert.AreEqual (ns, entity.SharpNamespace);
+ ClassicAssert.AreEqual (csharpName, entity.SharpTypeName);
}
}
}
@@ -1145,7 +1146,7 @@ public void MultipleImports ()
var localErrors = new ErrorHandling ();
var inputTarget = UniformTargetRepresentation.FromPath ("Consumer", new List () { consumerProvider.DirectoryPath }, localErrors);
- Assert.IsNotNull (inputTarget, "Didn't get an input target");
+ ClassicAssert.IsNotNull (inputTarget, "Didn't get an input target");
NewClassCompiler ncc = Utils.DefaultCSharpCompiler (inputTarget);
@@ -1262,8 +1263,8 @@ public init ()
public static void AssertBindingsCreated (string ouputDirectory, string moduleName)
{
string bindingDir = Path.Combine (ouputDirectory, "bindings");
- Assert.IsTrue (Directory.Exists (bindingDir), "Binding directory was not created?");
- Assert.IsTrue (File.Exists (Path.Combine (bindingDir, moduleName)), "Module type database not written out?");
+ ClassicAssert.IsTrue (Directory.Exists (bindingDir), "Binding directory was not created?");
+ ClassicAssert.IsTrue (File.Exists (Path.Combine (bindingDir, moduleName)), "Module type database not written out?");
}
@@ -1295,9 +1296,9 @@ public func toInt() -> Int {
static void XmlOutputExists(string directory)
{
var xmlDir = Path.Combine (directory, "XmlReflection");
- Assert.IsTrue (Directory.Exists (xmlDir), "reflection directory doesn't exist");
+ ClassicAssert.IsTrue (Directory.Exists (xmlDir), "reflection directory doesn't exist");
var file = Path.Combine (xmlDir, "Swift_XamReflect.xml");
- Assert.IsTrue (File.Exists (file), "reflection file doesn't exist");
+ ClassicAssert.IsTrue (File.Exists (file), "reflection file doesn't exist");
}
@@ -1502,7 +1503,7 @@ public func reportIt (a: EasyToRepresent) -> Bool {
typeof (ArgumentNullException), errID.Name, CSCodeBlock.Create (printer));
var callingCode = CSCodeBlock.Create (tryCatch);
- TestRunning.TestAndExecute (swiftCode, callingCode, "Here.Value cannot be null.\nParameter name: a\n");
+ TestRunning.TestAndExecute (swiftCode, callingCode, "Here.Value cannot be null. (Parameter 'a')\n");
}
[Test]
diff --git a/tests/tom-swifty-test/SwiftReflector/OverrideTests.cs b/tests/tom-swifty-test/SwiftReflector/OverrideTests.cs
index dce89b17..ffd239bb 100644
--- a/tests/tom-swifty-test/SwiftReflector/OverrideTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/OverrideTests.cs
@@ -14,6 +14,7 @@
using SwiftReflector.Inventory;
using System.Linq;
using Dynamo.CSLang;
+using NUnit.Framework.Legacy;
namespace SwiftReflector {
[TestFixture]
@@ -31,7 +32,7 @@ List ReflectClassDeclarations (string code)
List modules = compiler.ReflectToModules (new string [] { compiler.DirectoryPath },
new string [] { compiler.DirectoryPath }, "", "NameNotImportant");
- Assert.AreEqual (1, modules.Count);
+ ClassicAssert.AreEqual (1, modules.Count);
return modules [0].AllClasses;
}
}
@@ -42,7 +43,7 @@ public void SmokeTestOverride0 ()
{
string code = "open class Foo { public init() { }\nopen func doSomething() { }\n}\n";
List classes = ReflectClassDeclarations (code);
- Assert.AreEqual (1, classes.Count);
+ ClassicAssert.AreEqual (1, classes.Count);
ClassDeclaration theClass = classes [0].MakeUnrooted () as ClassDeclaration;
TypeMapper typeMapper = new TypeMapper (Compiler.kTypeDatabases, UnicodeMapper.Default);
@@ -50,10 +51,10 @@ public void SmokeTestOverride0 ()
OverrideBuilder overrider = new OverrideBuilder (typeMapper, theClass, null, new ModuleDeclaration ("OverrideModule"));
- Assert.IsNotNull (overrider.OverriddenClass);
- Assert.AreEqual (1, overrider.ClassImplementations.Count);
- Assert.IsNotNull (overrider.OverriddenVirtualMethods);
- Assert.AreEqual (1, overrider.OverriddenVirtualMethods.Count);
+ ClassicAssert.IsNotNull (overrider.OverriddenClass);
+ ClassicAssert.AreEqual (1, overrider.ClassImplementations.Count);
+ ClassicAssert.IsNotNull (overrider.OverriddenVirtualMethods);
+ ClassicAssert.AreEqual (1, overrider.OverriddenVirtualMethods.Count);
using (TempDirectoryFilenameProvider temp = new TempDirectoryFilenameProvider (null, false)) {
string file = temp.ProvideFileFor ("output.swift");
diff --git a/tests/tom-swifty-test/SwiftReflector/ProtocolConformanceTests.cs b/tests/tom-swifty-test/SwiftReflector/ProtocolConformanceTests.cs
index 8f2edd74..2395c33c 100644
--- a/tests/tom-swifty-test/SwiftReflector/ProtocolConformanceTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/ProtocolConformanceTests.cs
@@ -106,8 +106,8 @@ public func iterateThings (this: iteratorprotocol_xam_helper) -> String
[TestCase ("Bool", "Boolean", "[true, false, true]")]
- [TestCase ("Int", "nint", "[0, 1, 2]")]
- [TestCase ("UInt", "nuint", "[0, 1, 2]")]
+ [TestCase ("Int", "IntPtr", "[0, 1, 2]")]
+ [TestCase ("UInt", "UIntPtr", "[0, 1, 2]")]
[TestCase ("Int32", "Int32", "[0, 1, 2]")]
[TestCase ("UInt32", "UInt32", "[0, 1, 2]")]
[TestCase ("Float", "Single", "[0.1, 1.1, 2.1]")]
@@ -155,8 +155,8 @@ public func next () -> {swiftType}? {{
[TestCase ("Bool", "Boolean", "[true, false, true]")]
- [TestCase ("Int", "nint", "[0, 1, 2]")]
- [TestCase ("UInt", "nuint", "[0, 1, 2]")]
+ [TestCase ("Int", "IntPtr", "[0, 1, 2]")]
+ [TestCase ("UInt", "UIntPtr", "[0, 1, 2]")]
[TestCase ("Int32", "Int32", "[0, 1, 2]")]
[TestCase ("UInt32", "UInt32", "[0, 1, 2]")]
[TestCase ("Float", "Single", "[0.1, 1.1, 2.1]")]
diff --git a/tests/tom-swifty-test/SwiftReflector/Swift4DemanglerTests.cs b/tests/tom-swifty-test/SwiftReflector/Swift4DemanglerTests.cs
index 9a1c5e27..a70ad665 100644
--- a/tests/tom-swifty-test/SwiftReflector/Swift4DemanglerTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/Swift4DemanglerTests.cs
@@ -12,6 +12,7 @@
using Dynamo.CSLang;
using Dynamo;
using SwiftReflector.TypeMapping;
+using NUnit.Framework.Legacy;
namespace SwiftReflector.Demangling {
[TestFixture]
@@ -22,12 +23,12 @@ public class Swift4DemanglerTests {
public void TestFuncReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework10ReturnsIntSiyF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var sbt = tlf.Signature.ReturnType as SwiftBuiltInType;
- Assert.IsNotNull (sbt);
- Assert.AreEqual (CoreBuiltInType.Int, sbt.BuiltInType);
+ ClassicAssert.IsNotNull (sbt);
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, sbt.BuiltInType);
}
@@ -35,38 +36,38 @@ public void TestFuncReturningInt ()
public void TestFuncWithIntArgsReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework10ReturnsInt1a1bS2i_SitF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count);
- Assert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count);
+ ClassicAssert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
var bit = argTuple.Contents [0] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
- Assert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type1");
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type1");
}
[Test]
public void TestFuncWithUIntIntArgsReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework10ReturnsInt1a1bS2u_SitF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count);
- Assert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count);
+ ClassicAssert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
var bit = argTuple.Contents [0] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.UInt, bit.BuiltInType);
- Assert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.UInt, bit.BuiltInType);
+ ClassicAssert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
}
@@ -74,30 +75,30 @@ public void TestFuncWithUIntIntArgsReturningInt ()
public void TestFuncWithTupleOfUIntIntIntArgsReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework10ReturnsInt3arg1cS2u1a_Si1bt_SitF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count);
- Assert.AreEqual ("arg", argTuple.Contents [0].Name.ToString ());
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count);
+ ClassicAssert.AreEqual ("arg", argTuple.Contents [0].Name.ToString ());
var tuple = argTuple.Contents [0] as SwiftTupleType;
- Assert.IsNotNull (tuple);
- Assert.AreEqual (2, tuple.Contents.Count);
+ ClassicAssert.IsNotNull (tuple);
+ ClassicAssert.AreEqual (2, tuple.Contents.Count);
var bit = tuple.Contents [0] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual ("a", bit.Name.Name);
- Assert.AreEqual (CoreBuiltInType.UInt, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual ("a", bit.Name.Name);
+ ClassicAssert.AreEqual (CoreBuiltInType.UInt, bit.BuiltInType);
bit = tuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual ("b", bit.Name.Name);
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual ("b", bit.Name.Name);
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
- Assert.AreEqual ("c", argTuple.Contents [1].Name.ToString ());
+ ClassicAssert.AreEqual ("c", argTuple.Contents [1].Name.ToString ());
bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit2");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type1");
+ ClassicAssert.IsNotNull (bit, "bit2");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type1");
}
@@ -107,57 +108,57 @@ public void TestFuncWithTupleOfUIntIntIntArgsReturningInt ()
public void TestFuncWithBoolIntArgsReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework10ReturnsInt1a1bSiSb_SitF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count);
- Assert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count);
+ ClassicAssert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
var bit = argTuple.Contents [0] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
- Assert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
}
[Test]
public void TestFuncWithFloatIntArgsReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework10ReturnsInt1a1bSiSf_SitF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count);
- Assert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count);
+ ClassicAssert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
var bit = argTuple.Contents [0] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Float, bit.BuiltInType);
- Assert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Float, bit.BuiltInType);
+ ClassicAssert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
}
[Test]
public void TestFuncWithDoubleIntArgsReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework10ReturnsInt1a1bSiSd_SitF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count);
- Assert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count);
+ ClassicAssert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
var bit = argTuple.Contents [0] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Double, bit.BuiltInType);
- Assert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Double, bit.BuiltInType);
+ ClassicAssert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
}
@@ -165,20 +166,20 @@ public void TestFuncWithDoubleIntArgsReturningInt ()
public void TestFuncWithInOutIntArgsReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework10ReturnsInt1a1bS2iz_SitF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count);
- Assert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count);
+ ClassicAssert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
var bit = argTuple.Contents [0] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
- Assert.IsTrue (argTuple.Contents [0].IsReference);
- Assert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsTrue (argTuple.Contents [0].IsReference);
+ ClassicAssert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type1");
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type1");
}
@@ -186,21 +187,21 @@ public void TestFuncWithInOutIntArgsReturningInt ()
public void TestFuncWithClassIntArgsReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework10ReturnsInt1a1bSiAA7MyClassC_SitF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count);
- Assert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count);
+ ClassicAssert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
var ct = argTuple.Contents [0] as SwiftClassType;
- Assert.IsNotNull (ct, "ct");
- Assert.IsTrue (ct.IsClass);
- Assert.AreEqual ("unitHelpFrawework.MyClass", ct.ClassName.ToFullyQualifiedName (true));
- Assert.IsFalse (ct.IsReference);
- Assert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
+ ClassicAssert.IsNotNull (ct, "ct");
+ ClassicAssert.IsTrue (ct.IsClass);
+ ClassicAssert.AreEqual ("unitHelpFrawework.MyClass", ct.ClassName.ToFullyQualifiedName (true));
+ ClassicAssert.IsFalse (ct.IsReference);
+ ClassicAssert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
var bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
}
@@ -208,21 +209,21 @@ public void TestFuncWithClassIntArgsReturningInt ()
public void TestFuncWithInnerStructIntArgsReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework10ReturnsInt1a1bSiAA7MyClassC8InnerFooV_SitF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count);
- Assert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count);
+ ClassicAssert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
var ct = argTuple.Contents [0] as SwiftClassType;
- Assert.IsNotNull (ct, "ct");
- Assert.IsTrue (ct.IsStruct);
- Assert.AreEqual ("unitHelpFrawework.MyClass.InnerFoo", ct.ClassName.ToFullyQualifiedName (true));
- Assert.IsFalse (ct.IsReference);
- Assert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
+ ClassicAssert.IsNotNull (ct, "ct");
+ ClassicAssert.IsTrue (ct.IsStruct);
+ ClassicAssert.AreEqual ("unitHelpFrawework.MyClass.InnerFoo", ct.ClassName.ToFullyQualifiedName (true));
+ ClassicAssert.IsFalse (ct.IsReference);
+ ClassicAssert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
var bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
}
@@ -230,73 +231,73 @@ public void TestFuncWithInnerStructIntArgsReturningInt ()
public void TestFuncWithEnumIntArgsReturnInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework10ReturnsInt1a1bSiAA7FooEnumO_SitF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count);
- Assert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count);
+ ClassicAssert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
var ct = argTuple.Contents [0] as SwiftClassType;
- Assert.IsNotNull (ct, "ct");
- Assert.IsTrue (ct.IsEnum);
- Assert.AreEqual ("unitHelpFrawework.FooEnum", ct.ClassName.ToFullyQualifiedName (true));
- Assert.IsFalse (ct.IsReference);
- Assert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
+ ClassicAssert.IsNotNull (ct, "ct");
+ ClassicAssert.IsTrue (ct.IsEnum);
+ ClassicAssert.AreEqual ("unitHelpFrawework.FooEnum", ct.ClassName.ToFullyQualifiedName (true));
+ ClassicAssert.IsFalse (ct.IsReference);
+ ClassicAssert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
var bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
}
[Test]
public void TestFuncWithProtocolIntArgsReturnInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework10ReturnsInt1a1bSiAA11BarProtocol_p_SitF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count, "tuple count");
- Assert.AreEqual ("a", argTuple.Contents [0].Name.ToString (), "arg 1 name");
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count, "tuple count");
+ ClassicAssert.AreEqual ("a", argTuple.Contents [0].Name.ToString (), "arg 1 name");
var ct = argTuple.Contents [0] as SwiftClassType;
- Assert.IsNotNull (ct, "ct");
- Assert.IsTrue (ct.IsProtocol, "isProtocol");
- Assert.AreEqual ("unitHelpFrawework.BarProtocol", ct.ClassName.ToFullyQualifiedName (true), "name match");
- Assert.IsFalse (ct.IsReference, "isReference");
- Assert.AreEqual ("b", argTuple.Contents [1].Name.ToString (), "arg 2 name");
+ ClassicAssert.IsNotNull (ct, "ct");
+ ClassicAssert.IsTrue (ct.IsProtocol, "isProtocol");
+ ClassicAssert.AreEqual ("unitHelpFrawework.BarProtocol", ct.ClassName.ToFullyQualifiedName (true), "name match");
+ ClassicAssert.IsFalse (ct.IsReference, "isReference");
+ ClassicAssert.AreEqual ("b", argTuple.Contents [1].Name.ToString (), "arg 2 name");
var bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int");
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int");
}
[Test]
public void TestFuncWithBoolIntReturnTupleOfDoubleInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework12ReturnsTuple1a1bSb_SitSb_SitF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count);
- Assert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count);
+ ClassicAssert.AreEqual ("a", argTuple.Contents [0].Name.ToString ());
var bit = argTuple.Contents [0] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
- Assert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.AreEqual ("b", argTuple.Contents [1].Name.ToString ());
bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
var retTuple = tlf.Signature.ReturnType as SwiftTupleType;
- Assert.IsNotNull (retTuple);
- Assert.AreEqual (2, retTuple.Contents.Count);
+ ClassicAssert.IsNotNull (retTuple);
+ ClassicAssert.AreEqual (2, retTuple.Contents.Count);
bit = argTuple.Contents [0] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit2");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit2");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit3");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type1");
+ ClassicAssert.IsNotNull (bit, "bit3");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type1");
}
@@ -304,20 +305,20 @@ public void TestFuncWithBoolIntReturnTupleOfDoubleInt ()
public void TestFuncWithOptionalIntArgsReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework10ReturnsInt1aS2iSg_tF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var bgt = tlf.Signature.GetParameter (0) as SwiftBoundGenericType;
- Assert.AreEqual ("a", bgt.Name.ToString (), "name matches");
- Assert.IsNotNull (bgt, "bgt");
+ ClassicAssert.AreEqual ("a", bgt.Name.ToString (), "name matches");
+ ClassicAssert.IsNotNull (bgt, "bgt");
var baseType = bgt.BaseType as SwiftClassType;
- Assert.IsNotNull (baseType, "baseType");
- Assert.IsTrue (baseType.IsEnum, "isEnum");
- Assert.AreEqual ("Swift.Optional", baseType.ClassName.ToFullyQualifiedName (true), "is optional");
- Assert.AreEqual (1, bgt.BoundTypes.Count, "is 1 bound type");
+ ClassicAssert.IsNotNull (baseType, "baseType");
+ ClassicAssert.IsTrue (baseType.IsEnum, "isEnum");
+ ClassicAssert.AreEqual ("Swift.Optional", baseType.ClassName.ToFullyQualifiedName (true), "is optional");
+ ClassicAssert.AreEqual (1, bgt.BoundTypes.Count, "is 1 bound type");
var bit = bgt.BoundTypes [0] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "is built-in type");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int");
+ ClassicAssert.IsNotNull (bit, "is built-in type");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int");
}
@@ -325,80 +326,80 @@ public void TestFuncWithOptionalIntArgsReturningInt ()
public void TestClassMethodBoolReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7MyClassC8TestFunc1aSiSb_tF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual ("TestFunc", tlf.Name.Name);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual ("TestFunc", tlf.Name.Name);
var ucf = tlf.Signature as SwiftUncurriedFunctionType;
- Assert.IsNotNull (ucf, "ucf");
- Assert.IsTrue (ucf.UncurriedParameter.IsClass);
+ ClassicAssert.IsNotNull (ucf, "ucf");
+ ClassicAssert.IsTrue (ucf.UncurriedParameter.IsClass);
var bit = tlf.Signature.GetParameter (0) as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
bit = tlf.Signature.ReturnType as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
- Assert.IsFalse (tlf.Signature is SwiftStaticFunctionType);
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsFalse (tlf.Signature is SwiftStaticFunctionType);
}
[Test]
public void TestMethodBoolThrows ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7MyClassC11WillItThrow1aySb_tKF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.IsTrue (tlf.Signature.CanThrow);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsTrue (tlf.Signature.CanThrow);
}
[Test]
public void TestFuncBoolThrows ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework16MaybeItWillThrow1aySb_tKF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.IsTrue (tlf.Signature.CanThrow);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsTrue (tlf.Signature.CanThrow);
}
[Test]
public void TestStructMethodBoolReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework3FooV8TestFunc1aSiSb_tF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual ("TestFunc", tlf.Name.Name);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual ("TestFunc", tlf.Name.Name);
var ucf = tlf.Signature as SwiftUncurriedFunctionType;
- Assert.IsNotNull (ucf, "ucf");
- Assert.IsTrue (ucf.UncurriedParameter.IsStruct);
+ ClassicAssert.IsNotNull (ucf, "ucf");
+ ClassicAssert.IsTrue (ucf.UncurriedParameter.IsStruct);
var bit = tlf.Signature.GetParameter (0) as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
bit = tlf.Signature.ReturnType as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
- Assert.IsFalse (tlf.Signature is SwiftStaticFunctionType);
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsFalse (tlf.Signature is SwiftStaticFunctionType);
}
[Test]
public void TestEnumMethodBoolReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework3FooO8TestFunc1aSiSb_tF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual ("TestFunc", tlf.Name.Name);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual ("TestFunc", tlf.Name.Name);
var ucf = tlf.Signature as SwiftUncurriedFunctionType;
- Assert.IsNotNull (ucf, "ucf");
- Assert.IsTrue (ucf.UncurriedParameter.IsEnum);
+ ClassicAssert.IsNotNull (ucf, "ucf");
+ ClassicAssert.IsTrue (ucf.UncurriedParameter.IsEnum);
var bit = tlf.Signature.GetParameter (0) as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
bit = tlf.Signature.ReturnType as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
- Assert.IsFalse (tlf.Signature is SwiftStaticFunctionType);
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsFalse (tlf.Signature is SwiftStaticFunctionType);
}
@@ -406,92 +407,92 @@ public void TestEnumMethodBoolReturningInt ()
public void TestStaticClassMethodBoolReturningInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework3FooC8TestFunc1aSiSb_tFZ", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual ("TestFunc", tlf.Name.Name);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual ("TestFunc", tlf.Name.Name);
var bit = tlf.Signature.GetParameter (0) as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
bit = tlf.Signature.ReturnType as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
- Assert.IsTrue (tlf.Signature is SwiftStaticFunctionType);
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsTrue (tlf.Signature is SwiftStaticFunctionType);
}
[Test]
public void TestClassNonAllocatingCtorIntBool ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7MyClassC1a1bACSi_Sbtcfc", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (".nctor", tlf.Name.Name);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (".nctor", tlf.Name.Name);
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count);
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count);
var bit = argTuple.Contents [0] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
}
[Test]
public void TestClassCtorIntBool ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7MyClassC1a1bACSi_SbtcfC", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (".ctor", tlf.Name.Name);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (".ctor", tlf.Name.Name);
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count);
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count);
var bit = argTuple.Contents [0] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
}
[Test]
public void TestStructCtorIntBool ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework8MyStructV1a1bACSi_SbtcfC", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (".ctor", tlf.Name.Name);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (".ctor", tlf.Name.Name);
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (2, argTuple.Contents.Count);
+ ClassicAssert.AreEqual (2, argTuple.Contents.Count);
var bit = argTuple.Contents [0] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
}
[Test]
public void TestEnumCtorIntBool ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework6MyEnumO1a1b1cACSb_SiSftcfC", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (".ctor", tlf.Name.Name);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (".ctor", tlf.Name.Name);
var argTuple = tlf.Signature.Parameters as SwiftTupleType;
- Assert.AreEqual (3, argTuple.Contents.Count);
+ ClassicAssert.AreEqual (3, argTuple.Contents.Count);
var bit = argTuple.Contents [0] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
bit = argTuple.Contents [1] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
bit = argTuple.Contents [2] as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit2");
- Assert.AreEqual (CoreBuiltInType.Float, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit2");
+ ClassicAssert.AreEqual (CoreBuiltInType.Float, bit.BuiltInType);
}
@@ -500,12 +501,12 @@ public void TestEnumCtorIntBool ()
public void TestClassDtor ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7MyClassCfd", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var dtor = tlf.Signature as SwiftDestructorType;
- Assert.IsNotNull (dtor, "dtor");
- Assert.AreEqual (Decomposer.kSwiftNonDeallocatingDestructorName.Name, dtor.Name.Name);
+ ClassicAssert.IsNotNull (dtor, "dtor");
+ ClassicAssert.AreEqual (Decomposer.kSwiftNonDeallocatingDestructorName.Name, dtor.Name.Name);
}
@@ -513,110 +514,110 @@ public void TestClassDtor ()
public void TestClassDeallocatingDtor ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7MyClassCfD", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var dtor = tlf.Signature as SwiftDestructorType;
- Assert.IsNotNull (dtor, "dtor");
- Assert.AreEqual (Decomposer.kSwiftDeallocatingDestructorName.Name, dtor.Name.Name);
+ ClassicAssert.IsNotNull (dtor, "dtor");
+ ClassicAssert.AreEqual (Decomposer.kSwiftDeallocatingDestructorName.Name, dtor.Name.Name);
}
[Test]
public void TestClassGetterInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7MyClassC1xSivg", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.AreEqual ("x", prop.Name.Name);
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.AreEqual ("x", prop.Name.Name);
var bit = prop.OfType as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
- Assert.AreEqual (PropertyType.Getter, prop.PropertyType);
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.AreEqual (PropertyType.Getter, prop.PropertyType);
}
[Test]
public void TestClassSetterInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7MyClassC1xSivs", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsFalse (prop.IsStatic);
- Assert.AreEqual ("x", prop.Name.Name);
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsFalse (prop.IsStatic);
+ ClassicAssert.AreEqual ("x", prop.Name.Name);
var bit = prop.OfType as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
- Assert.AreEqual (PropertyType.Setter, prop.PropertyType);
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.AreEqual (PropertyType.Setter, prop.PropertyType);
}
[Test]
public void TestGetterSubscriptIntBoolOntoFloat ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7MyClassCySfSi_Sbtcig", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.AreEqual ("subscript", prop.Name.Name);
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.AreEqual ("subscript", prop.Name.Name);
var sft = prop.OfType as SwiftFunctionType;
- Assert.IsNotNull (sft, "sft");
- Assert.AreEqual (2, sft.ParameterCount);
+ ClassicAssert.IsNotNull (sft, "sft");
+ ClassicAssert.AreEqual (2, sft.ParameterCount);
var bit = sft.GetParameter (0) as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
bit = sft.GetParameter (1) as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
bit = sft.ReturnType as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bi2");
- Assert.AreEqual (CoreBuiltInType.Float, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bi2");
+ ClassicAssert.AreEqual (CoreBuiltInType.Float, bit.BuiltInType);
}
[Test]
public void TestSetterSubscriptIntBoolOntoFloat ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7MyClassCySfSi_Sbtcis", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.AreEqual ("subscript", prop.Name.Name);
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.AreEqual ("subscript", prop.Name.Name);
var sft = prop.OfType as SwiftFunctionType;
- Assert.IsNotNull (sft, "sft");
- Assert.AreEqual (3, sft.ParameterCount);
+ ClassicAssert.IsNotNull (sft, "sft");
+ ClassicAssert.AreEqual (3, sft.ParameterCount);
var bit = sft.GetParameter (0) as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Float, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Float, bit.BuiltInType);
bit = sft.GetParameter (1) as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit1");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.IsNotNull (bit, "bit1");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
bit = sft.GetParameter (2) as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit2");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.IsNotNull (bit, "bit2");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
}
[Test]
public void TestClassStaticGetterInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7MyClassC6FoobleSivgZ", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsTrue (prop.IsStatic);
- Assert.AreEqual ("Fooble", prop.Name.Name);
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsTrue (prop.IsStatic);
+ ClassicAssert.AreEqual ("Fooble", prop.Name.Name);
var bit = prop.OfType as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
- Assert.AreEqual (PropertyType.Getter, prop.PropertyType);
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.AreEqual (PropertyType.Getter, prop.PropertyType);
}
@@ -624,17 +625,17 @@ public void TestClassStaticGetterInt ()
public void TestClassStaticSetterInt ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7MyClassC6FoobleSivsZ", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsTrue (prop.IsStatic);
- Assert.AreEqual ("Fooble", prop.Name.Name);
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsTrue (prop.IsStatic);
+ ClassicAssert.AreEqual ("Fooble", prop.Name.Name);
var bit = prop.OfType as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
- Assert.AreEqual (PropertyType.Setter, prop.PropertyType);
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, bit.BuiltInType, "is int type");
+ ClassicAssert.AreEqual (PropertyType.Setter, prop.PropertyType);
}
@@ -643,16 +644,16 @@ public void TestClassStaticSetterInt ()
public void TestMethodTakingFunc ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7MyClassC7callFoo1ayyyXE_tF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var func = tlf.Signature as SwiftUncurriedFunctionType;
- Assert.IsNotNull (func, "func");
- Assert.AreEqual (1, func.ParameterCount);
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.AreEqual (1, func.ParameterCount);
var funcArg = func.GetParameter (0) as SwiftFunctionType;
- Assert.IsNotNull (funcArg);
- Assert.AreEqual (0, funcArg.ParameterCount);
- Assert.AreEqual ("a", funcArg.Name.Name);
+ ClassicAssert.IsNotNull (funcArg);
+ ClassicAssert.AreEqual (0, funcArg.ParameterCount);
+ ClassicAssert.AreEqual ("a", funcArg.Name.Name);
}
@@ -660,36 +661,36 @@ public void TestMethodTakingFunc ()
public void TestGlobalGetterBool ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7TroubleSbvg", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsFalse (prop.IsStatic);
- Assert.IsTrue (prop.IsGlobal);
- Assert.AreEqual ("Trouble", prop.Name.Name);
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsFalse (prop.IsStatic);
+ ClassicAssert.IsTrue (prop.IsGlobal);
+ ClassicAssert.AreEqual ("Trouble", prop.Name.Name);
var bit = prop.OfType as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
- Assert.AreEqual (PropertyType.Getter, prop.PropertyType);
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.AreEqual (PropertyType.Getter, prop.PropertyType);
}
[Test]
public void TestGlobalSetterBool ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7TroubleSbvs", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "prop");
- Assert.IsFalse (prop.IsStatic);
- Assert.IsTrue (prop.IsGlobal);
- Assert.AreEqual ("Trouble", prop.Name.Name);
+ ClassicAssert.IsNotNull (prop, "prop");
+ ClassicAssert.IsFalse (prop.IsStatic);
+ ClassicAssert.IsTrue (prop.IsGlobal);
+ ClassicAssert.AreEqual ("Trouble", prop.Name.Name);
var bit = prop.OfType as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
- Assert.AreEqual (PropertyType.Setter, prop.PropertyType);
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType);
+ ClassicAssert.AreEqual (PropertyType.Setter, prop.PropertyType);
}
@@ -697,13 +698,13 @@ public void TestGlobalSetterBool ()
public void TestGlobalVariableBool ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7TroubleSbvp", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlv = tld as TLVariable;
- Assert.IsNotNull (tlv, "tlv");
- Assert.AreEqual ("Trouble", tlv.Name.Name, "var name");
+ ClassicAssert.IsNotNull (tlv, "tlv");
+ ClassicAssert.AreEqual ("Trouble", tlv.Name.Name, "var name");
var bit = tlv.OfType as SwiftBuiltInType;
- Assert.IsNotNull (bit, "bit");
- Assert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType, "is int");
+ ClassicAssert.IsNotNull (bit, "bit");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, bit.BuiltInType, "is int");
}
@@ -711,12 +712,12 @@ public void TestGlobalVariableBool ()
public void TestClassMetadataAccessor ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework3FooCMa", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var cctor = tlf.Signature as SwiftClassConstructorType;
- Assert.AreEqual (Decomposer.kSwiftClassConstructorName.Name, tlf.Name.Name);
- Assert.AreEqual ("unitHelpFrawework.Foo", tlf.Class.ClassName.ToFullyQualifiedName (true));
+ ClassicAssert.AreEqual (Decomposer.kSwiftClassConstructorName.Name, tlf.Name.Name);
+ ClassicAssert.AreEqual ("unitHelpFrawework.Foo", tlf.Class.ClassName.ToFullyQualifiedName (true));
}
@@ -724,68 +725,68 @@ public void TestClassMetadataAccessor ()
public void TestClassMetadata ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework3FooCN", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlm = tld as TLDirectMetadata;
- Assert.IsNotNull (tlm, "tlm");
- Assert.AreEqual ("unitHelpFrawework.Foo", tlm.Class.ClassName.ToFullyQualifiedName (true));
- Assert.IsTrue (tlm.Class.IsClass);
+ ClassicAssert.IsNotNull (tlm, "tlm");
+ ClassicAssert.AreEqual ("unitHelpFrawework.Foo", tlm.Class.ClassName.ToFullyQualifiedName (true));
+ ClassicAssert.IsTrue (tlm.Class.IsClass);
}
[Test]
public void TestNominalTypeDescriptor ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework3FooVMn", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tln = tld as TLNominalTypeDescriptor;
- Assert.IsNotNull (tln, "tln");
- Assert.AreEqual ("unitHelpFrawework.Foo", tln.Class.ClassName.ToFullyQualifiedName (true));
- Assert.IsTrue (tln.Class.IsStruct);
+ ClassicAssert.IsNotNull (tln, "tln");
+ ClassicAssert.AreEqual ("unitHelpFrawework.Foo", tln.Class.ClassName.ToFullyQualifiedName (true));
+ ClassicAssert.IsTrue (tln.Class.IsStruct);
}
[Test]
public void TestProtocolDescriptor ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework6SummerMp", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var ptd = tld as TLProtocolTypeDescriptor;
- Assert.IsNotNull (ptd, "ptd");
- Assert.AreEqual ("unitHelpFrawework.Summer", ptd.Class.ClassName.ToFullyQualifiedName (true));
+ ClassicAssert.IsNotNull (ptd, "ptd");
+ ClassicAssert.AreEqual ("unitHelpFrawework.Summer", ptd.Class.ClassName.ToFullyQualifiedName (true));
}
[Test]
public void TestVarInitializer ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework3FooC5waterSivpfi", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var initializer = tlf.Signature as SwiftInitializerType;
- Assert.IsNotNull (initializer, "initializer");
- Assert.AreEqual ("unitHelpFrawework.Foo", initializer.Owner.ClassName.ToFullyQualifiedName (true));
- Assert.AreEqual ("water", initializer.Name.Name);
- Assert.AreEqual (InitializerType.Variable, initializer.InitializerType);
+ ClassicAssert.IsNotNull (initializer, "initializer");
+ ClassicAssert.AreEqual ("unitHelpFrawework.Foo", initializer.Owner.ClassName.ToFullyQualifiedName (true));
+ ClassicAssert.AreEqual ("water", initializer.Name.Name);
+ ClassicAssert.AreEqual (InitializerType.Variable, initializer.InitializerType);
}
[Test]
public void TestLazyCacheVariable ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework3FooCML", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tllcv = tld as TLLazyCacheVariable;
- Assert.IsNotNull (tllcv, "tllcv");
- Assert.AreEqual ("unitHelpFrawework.Foo", tllcv.Class.ClassName.ToFullyQualifiedName (true));
+ ClassicAssert.IsNotNull (tllcv, "tllcv");
+ ClassicAssert.AreEqual ("unitHelpFrawework.Foo", tllcv.Class.ClassName.ToFullyQualifiedName (true));
}
[Test]
public void TestProtocolWitnessTable ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework3FooCAA6SummerAAWP", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var witness = tlf.Signature as SwiftWitnessTableType;
- Assert.IsNotNull (witness, "witness");
- Assert.AreEqual (WitnessType.Protocol, witness.WitnessType);
+ ClassicAssert.IsNotNull (witness, "witness");
+ ClassicAssert.AreEqual (WitnessType.Protocol, witness.WitnessType);
}
[Test]
@@ -793,12 +794,12 @@ public void TestProtocolWitnessTable ()
public void TestProtocolWitnessAccessor ()
{
var tld = Decomposer.Decompose ("__T05None13FooCAA6SummerAAWa", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var witness = tlf.Signature as SwiftWitnessTableType;
- Assert.IsNotNull (witness, "witness");
- Assert.AreEqual (WitnessType.ProtocolAccessor, witness.WitnessType);
+ ClassicAssert.IsNotNull (witness, "witness");
+ ClassicAssert.AreEqual (WitnessType.ProtocolAccessor, witness.WitnessType);
}
@@ -806,129 +807,129 @@ public void TestProtocolWitnessAccessor ()
public void TestValueWitnessTable ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework8TheThingVWV", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var witness = tlf.Signature as SwiftWitnessTableType;
- Assert.IsNotNull (witness, "witness");
- Assert.AreEqual (WitnessType.Value, witness.WitnessType);
+ ClassicAssert.IsNotNull (witness, "witness");
+ ClassicAssert.AreEqual (WitnessType.Value, witness.WitnessType);
}
[Test]
public void TestGenericFuncOfT ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7doPrint1ayx_tlF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var func = tlf.Signature as SwiftFunctionType;
- Assert.IsNotNull (func, "func");
- Assert.IsTrue (func.ContainsGenericParameters);
- Assert.AreEqual (1, func.GenericArguments.Count);
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.IsTrue (func.ContainsGenericParameters);
+ ClassicAssert.AreEqual (1, func.GenericArguments.Count);
var genericParam = func.GetParameter (0) as SwiftGenericArgReferenceType;
- Assert.IsNotNull (genericParam, "genericParam");
- Assert.AreEqual (0, genericParam.Depth, "0 depth");
- Assert.AreEqual (0, genericParam.Index, "0 index");
- Assert.AreEqual (0, func.GenericArguments [0].Constraints.Count, "0 constraints at index 0");
+ ClassicAssert.IsNotNull (genericParam, "genericParam");
+ ClassicAssert.AreEqual (0, genericParam.Depth, "0 depth");
+ ClassicAssert.AreEqual (0, genericParam.Index, "0 index");
+ ClassicAssert.AreEqual (0, func.GenericArguments [0].Constraints.Count, "0 constraints at index 0");
}
[Test]
public void TestGenericFuncOfTUOneProtoConstraint ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7doPrint1a1byx_q_tAA5AdderR_r0_lF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var func = tlf.Signature as SwiftFunctionType;
- Assert.IsNotNull (func, "func");
- Assert.IsTrue (func.ContainsGenericParameters);
- Assert.AreEqual (2, func.GenericArguments.Count);
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.IsTrue (func.ContainsGenericParameters);
+ ClassicAssert.AreEqual (2, func.GenericArguments.Count);
var genericParam = func.GetParameter (0) as SwiftGenericArgReferenceType;
- Assert.IsNotNull (genericParam, "genericParam");
- Assert.AreEqual (0, genericParam.Depth, "0 depth");
- Assert.AreEqual (0, genericParam.Index, "0 index");
- Assert.AreEqual (0, func.GenericArguments [0].Constraints.Count, "0 constraints at index 0");
- Assert.AreEqual (1, func.GenericArguments [1].Constraints.Count, "1 constraint at index 1");
+ ClassicAssert.IsNotNull (genericParam, "genericParam");
+ ClassicAssert.AreEqual (0, genericParam.Depth, "0 depth");
+ ClassicAssert.AreEqual (0, genericParam.Index, "0 index");
+ ClassicAssert.AreEqual (0, func.GenericArguments [0].Constraints.Count, "0 constraints at index 0");
+ ClassicAssert.AreEqual (1, func.GenericArguments [1].Constraints.Count, "1 constraint at index 1");
var constraint = func.GenericArguments [1].Constraints [0] as SwiftClassType;
- Assert.IsNotNull (constraint, "constraint");
- Assert.IsTrue (constraint.IsProtocol);
+ ClassicAssert.IsNotNull (constraint, "constraint");
+ ClassicAssert.IsTrue (constraint.IsProtocol);
}
[Test]
public void TestGenericFuncOfTUOneClassConstraint ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7doPrint1a1byx_q_tAA3FooCRbzr0_lF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var func = tlf.Signature as SwiftFunctionType;
- Assert.IsNotNull (func, "func");
- Assert.IsTrue (func.ContainsGenericParameters);
- Assert.AreEqual (2, func.GenericArguments.Count);
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.IsTrue (func.ContainsGenericParameters);
+ ClassicAssert.AreEqual (2, func.GenericArguments.Count);
var genericParam = func.GetParameter (0) as SwiftGenericArgReferenceType;
- Assert.IsNotNull (genericParam, "genericParam");
- Assert.AreEqual (0, genericParam.Depth, "0 depth");
- Assert.AreEqual (0, genericParam.Index, "0 index");
- Assert.AreEqual (1, func.GenericArguments [0].Constraints.Count, "1 constraint at index 0");
- Assert.AreEqual (0, func.GenericArguments [1].Constraints.Count, "0 constraint at index 0");
+ ClassicAssert.IsNotNull (genericParam, "genericParam");
+ ClassicAssert.AreEqual (0, genericParam.Depth, "0 depth");
+ ClassicAssert.AreEqual (0, genericParam.Index, "0 index");
+ ClassicAssert.AreEqual (1, func.GenericArguments [0].Constraints.Count, "1 constraint at index 0");
+ ClassicAssert.AreEqual (0, func.GenericArguments [1].Constraints.Count, "0 constraint at index 0");
var constraint = func.GenericArguments [0].Constraints [0] as SwiftClassType;
- Assert.IsNotNull (constraint, "constraint");
- Assert.IsTrue (constraint.IsClass);
+ ClassicAssert.IsNotNull (constraint, "constraint");
+ ClassicAssert.IsTrue (constraint.IsClass);
}
[Test]
public void TestGenericFuncOfTUTwoOneProtocolConstraint ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7doPrint1a1byx_q_tAA5AdderR_AA6SubberR_r0_lF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var func = tlf.Signature as SwiftFunctionType;
- Assert.IsNotNull (func, "func");
- Assert.IsTrue (func.ContainsGenericParameters);
- Assert.AreEqual (2, func.GenericArguments.Count);
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.IsTrue (func.ContainsGenericParameters);
+ ClassicAssert.AreEqual (2, func.GenericArguments.Count);
var genericParam = func.GetParameter (0) as SwiftGenericArgReferenceType;
- Assert.IsNotNull (genericParam, "genericParam");
- Assert.AreEqual (0, genericParam.Depth, "0 depth");
- Assert.AreEqual (0, genericParam.Index, "0 index");
- Assert.AreEqual (2, func.GenericArguments [1].Constraints.Count, "2 constraints at index 1");
- Assert.AreEqual (0, func.GenericArguments [0].Constraints.Count, "0 constraints at index 0");
+ ClassicAssert.IsNotNull (genericParam, "genericParam");
+ ClassicAssert.AreEqual (0, genericParam.Depth, "0 depth");
+ ClassicAssert.AreEqual (0, genericParam.Index, "0 index");
+ ClassicAssert.AreEqual (2, func.GenericArguments [1].Constraints.Count, "2 constraints at index 1");
+ ClassicAssert.AreEqual (0, func.GenericArguments [0].Constraints.Count, "0 constraints at index 0");
var constraint = func.GenericArguments [1].Constraints [0] as SwiftClassType;
- Assert.IsNotNull (constraint, "constraint");
- Assert.IsTrue (constraint.IsProtocol);
+ ClassicAssert.IsNotNull (constraint, "constraint");
+ ClassicAssert.IsTrue (constraint.IsProtocol);
constraint = func.GenericArguments [1].Constraints [1] as SwiftClassType;
- Assert.IsNotNull (constraint, "constraint");
- Assert.IsTrue (constraint.IsProtocol);
+ ClassicAssert.IsNotNull (constraint, "constraint");
+ ClassicAssert.IsTrue (constraint.IsProtocol);
}
[Test]
public void TestGenericFuncOfGenericClass ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework7doPrint1ayAA3FooCyxG_tlF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
+ ClassicAssert.IsNotNull (tlf, "tlf");
var func = tlf.Signature as SwiftFunctionType;
- Assert.IsNotNull (func, "func");
- Assert.IsTrue (func.ContainsGenericParameters);
- Assert.AreEqual (1, func.GenericArguments.Count, "1 gen arg");
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.IsTrue (func.ContainsGenericParameters);
+ ClassicAssert.AreEqual (1, func.GenericArguments.Count, "1 gen arg");
var genericParam = func.GetParameter (0) as SwiftBoundGenericType;
- Assert.AreEqual (1, genericParam.BoundTypes.Count, "1 bound type");
+ ClassicAssert.AreEqual (1, genericParam.BoundTypes.Count, "1 bound type");
var genericParamType = genericParam.BoundTypes [0] as SwiftGenericArgReferenceType;
- Assert.IsNotNull (genericParamType, "genericParamType");
- Assert.AreEqual (0, genericParamType.Depth, "0 depth");
- Assert.AreEqual (0, genericParamType.Index, "0 index");
+ ClassicAssert.IsNotNull (genericParamType, "genericParamType");
+ ClassicAssert.AreEqual (0, genericParamType.Depth, "0 depth");
+ ClassicAssert.AreEqual (0, genericParamType.Index, "0 index");
}
[Test]
public void TestOperatorEqEq ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework3FooC2eeoiySbAC_ACtFZ", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (OperatorType.Infix, tlf.Operator, "operator");
- Assert.AreEqual ("==", tlf.Name.Name);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (OperatorType.Infix, tlf.Operator, "operator");
+ ClassicAssert.AreEqual ("==", tlf.Name.Name);
}
@@ -936,35 +937,35 @@ public void TestOperatorEqEq ()
public void TestOperatorMinusPlusMinus ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework3spsoiyS2i_SitF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (OperatorType.Infix, tlf.Operator, "operator");
- Assert.AreEqual ("-+-", tlf.Name.Name);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (OperatorType.Infix, tlf.Operator, "operator");
+ ClassicAssert.AreEqual ("-+-", tlf.Name.Name);
}
[Test]
public void TestUnicodeOperator ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework008deiFBEEeopyS2bF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual ('\u2757', tlf.Name.Name [0]);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual ('\u2757', tlf.Name.Name [0]);
}
[Test]
public void TestAnyObject ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework3boo1byyXl_tF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (1, tlf.Signature.ParameterCount);
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (1, tlf.Signature.ParameterCount);
var cl = tlf.Signature.GetParameter (0) as SwiftClassType;
- Assert.IsNotNull (cl, "cl");
- Assert.AreEqual ("Swift.AnyObject", cl.ClassName.ToFullyQualifiedName ());
- Assert.IsTrue (cl.IsClass);
+ ClassicAssert.IsNotNull (cl, "cl");
+ ClassicAssert.AreEqual ("Swift.AnyObject", cl.ClassName.ToFullyQualifiedName ());
+ ClassicAssert.IsTrue (cl.IsClass);
}
@@ -972,44 +973,44 @@ public void TestAnyObject ()
public void TestAny ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework3foo1byyp_tF", false);
- Assert.IsNotNull (tld, "tld");
+ ClassicAssert.IsNotNull (tld, "tld");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "tlf");
- Assert.AreEqual (1, tlf.Signature.ParameterCount, "1 parameter");
+ ClassicAssert.IsNotNull (tlf, "tlf");
+ ClassicAssert.AreEqual (1, tlf.Signature.ParameterCount, "1 parameter");
var cl = tlf.Signature.GetParameter (0) as SwiftClassType;
- Assert.IsNotNull (cl, "cl");
- Assert.AreEqual ("Swift.Any", cl.ClassName.ToFullyQualifiedName ());
- Assert.IsTrue (cl.IsProtocol);
+ ClassicAssert.IsNotNull (cl, "cl");
+ ClassicAssert.AreEqual ("Swift.Any", cl.ClassName.ToFullyQualifiedName ());
+ ClassicAssert.IsTrue (cl.IsProtocol);
}
[Test]
public void TestOptionalCtor ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework3FooC4failACSgSb_tcfc", false);
- Assert.IsNotNull (tld, "Failed decomposition");
+ ClassicAssert.IsNotNull (tld, "Failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "Expected function");
- Assert.IsTrue (tlf.Signature.IsConstructor, "Expected constructor");
+ ClassicAssert.IsNotNull (tlf, "Expected function");
+ ClassicAssert.IsTrue (tlf.Signature.IsConstructor, "Expected constructor");
var ctorReturn = tlf.Signature.ReturnType as SwiftBoundGenericType;
- Assert.IsNotNull (ctorReturn, "Expected bound generic return");
+ ClassicAssert.IsNotNull (ctorReturn, "Expected bound generic return");
var payload = ctorReturn.BoundTypes [0] as SwiftClassType;
- Assert.IsNotNull (ctorReturn, "Expected class");
- Assert.AreEqual ("unitHelpFrawework.Foo", payload.ClassName.ToFullyQualifiedName (true), "Expected None.Foo");
- Assert.IsTrue (tlf.Signature.IsOptionalConstructor, "Not an optional ctor");
+ ClassicAssert.IsNotNull (ctorReturn, "Expected class");
+ ClassicAssert.AreEqual ("unitHelpFrawework.Foo", payload.ClassName.ToFullyQualifiedName (true), "Expected None.Foo");
+ ClassicAssert.IsTrue (tlf.Signature.IsOptionalConstructor, "Not an optional ctor");
}
[Test]
public void TestStaticExtensionFunc ()
{
var tld = Decomposer.Decompose ("_$sSi17unitHelpFraweworkE3fooSiyFZ", false);
- Assert.IsNotNull (tld, "Failed decomposition");
+ ClassicAssert.IsNotNull (tld, "Failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "Expected function");
- Assert.IsTrue (tlf.Signature.IsExtension, "Expected extension");
- Assert.IsTrue (tlf.Signature is SwiftStaticFunctionType, "Expected static function");
+ ClassicAssert.IsNotNull (tlf, "Expected function");
+ ClassicAssert.IsTrue (tlf.Signature.IsExtension, "Expected extension");
+ ClassicAssert.IsTrue (tlf.Signature is SwiftStaticFunctionType, "Expected static function");
var scalar = tlf.Signature.ExtensionOn as SwiftBuiltInType;
- Assert.IsNotNull (scalar, "Expected swift built in type");
- Assert.AreEqual (CoreBuiltInType.Int, scalar.BuiltInType, "Expected an Int");
+ ClassicAssert.IsNotNull (scalar, "Expected swift built in type");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, scalar.BuiltInType, "Expected an Int");
}
@@ -1017,14 +1018,14 @@ public void TestStaticExtensionFunc ()
public void TestStaticExtensionProp ()
{
var tld = Decomposer.Decompose ("_$sSi17unitHelpFraweworkE3fooSivgZ", false);
- Assert.IsNotNull (tld, "Failed decomposition");
+ ClassicAssert.IsNotNull (tld, "Failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "Expected function");
- Assert.IsTrue (tlf.Signature.IsExtension, "Expected extension");
- Assert.IsTrue (tlf.Signature is SwiftPropertyType, "Expected property");
+ ClassicAssert.IsNotNull (tlf, "Expected function");
+ ClassicAssert.IsTrue (tlf.Signature.IsExtension, "Expected extension");
+ ClassicAssert.IsTrue (tlf.Signature is SwiftPropertyType, "Expected property");
var scalar = tlf.Signature.ExtensionOn as SwiftBuiltInType;
- Assert.IsNotNull (scalar, "Expected swift built in type");
- Assert.AreEqual (CoreBuiltInType.Int, scalar.BuiltInType, "Expected an Int");
+ ClassicAssert.IsNotNull (scalar, "Expected swift built in type");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, scalar.BuiltInType, "Expected an Int");
}
@@ -1032,13 +1033,13 @@ public void TestStaticExtensionProp ()
public void TestGenericExtensionOnFunc ()
{
var tld = Decomposer.Decompose ("_$sSb17unitHelpFraweworkE5truth1aSSx_tAA6TruthyRzlF", false);
- Assert.IsNotNull (tld, "Failed decomposition");
+ ClassicAssert.IsNotNull (tld, "Failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "Expected function");
- Assert.IsTrue (tlf.Signature.IsExtension, "Expected extension");
+ ClassicAssert.IsNotNull (tlf, "Expected function");
+ ClassicAssert.IsTrue (tlf.Signature.IsExtension, "Expected extension");
var scalar = tlf.Signature.ExtensionOn as SwiftBuiltInType;
- Assert.IsNotNull (scalar, "Expected swift built int type");
- Assert.AreEqual (CoreBuiltInType.Bool, scalar.BuiltInType, "Expected a bool");
+ ClassicAssert.IsNotNull (scalar, "Expected swift built int type");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, scalar.BuiltInType, "Expected a bool");
}
@@ -1046,22 +1047,22 @@ public void TestGenericExtensionOnFunc ()
public void TestExtensionSubscript ()
{
var tld = Decomposer.Decompose ("_$sSa17unitHelpFraweworkAA6TruthyRzlEyxSgSScig", false);
- Assert.IsNotNull (tld, "Failed decomposition");
+ ClassicAssert.IsNotNull (tld, "Failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "Expected function");
- Assert.IsTrue (tlf.Signature.IsExtension, "Expected extension");
+ ClassicAssert.IsNotNull (tlf, "Expected function");
+ ClassicAssert.IsTrue (tlf.Signature.IsExtension, "Expected extension");
var prop = tlf.Signature as SwiftPropertyType;
- Assert.IsNotNull (prop, "Expected property");
- Assert.IsTrue (prop.IsSubscript, "Expected subscript");
+ ClassicAssert.IsNotNull (prop, "Expected property");
+ ClassicAssert.IsTrue (prop.IsSubscript, "Expected subscript");
}
[Test]
public void TestEulerOperatorDemangle ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework003BehopyySbyXKF", false);
- Assert.IsNotNull (tld, "Failed decomposition");
+ ClassicAssert.IsNotNull (tld, "Failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "Expected function");
+ ClassicAssert.IsNotNull (tlf, "Expected function");
}
@@ -1069,10 +1070,10 @@ public void TestEulerOperatorDemangle ()
public void TestObjCTLFunction ()
{
var tld = Decomposer.Decompose ("_$s17unitHelpFrawework21PathPositionAnimationC014createKeyframeF033_3D85A716E8AC30D62D97E78DB643A23DLLyyF", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "expected function");
- Assert.AreEqual (tlf.Name.Name, "_3D85A716E8AC30D62D97E78DB643A23D", "name mistmatch.");
+ ClassicAssert.IsNotNull (tlf, "expected function");
+ ClassicAssert.AreEqual (tlf.Name.Name, "_3D85A716E8AC30D62D97E78DB643A23D", "name mistmatch.");
}
@@ -1080,10 +1081,10 @@ public void TestObjCTLFunction ()
public void TestMaterializerExtension1 ()
{
var tld = Decomposer.Decompose ("__T0So6UIViewC12RazzleDazzleE14scaleTransformSC08CGAffineE0VSgfm", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "expected function");
- Assert.AreEqual (tlf.Name.Name, "scaleTransform", "name mismatch");
+ ClassicAssert.IsNotNull (tlf, "expected function");
+ ClassicAssert.AreEqual (tlf.Name.Name, "scaleTransform", "name mismatch");
}
[Test]
@@ -1091,10 +1092,10 @@ public void TestMaterializerExtension1 ()
public void TestMaterializerExtension2 ()
{
var tld = Decomposer.Decompose ("", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "expected function");
- Assert.AreEqual (tlf.Name.Name, "rotationTransform", "name mismatch");
+ ClassicAssert.IsNotNull (tlf, "expected function");
+ ClassicAssert.AreEqual (tlf.Name.Name, "rotationTransform", "name mismatch");
}
[Test]
@@ -1102,36 +1103,36 @@ public void TestMaterializerExtension2 ()
public void TestMaterializerExtension3 ()
{
var tld = Decomposer.Decompose ("", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "expected function");
- Assert.AreEqual (tlf.Name.Name, "translationTransform", "name mismatch");
+ ClassicAssert.IsNotNull (tlf, "expected function");
+ ClassicAssert.AreEqual (tlf.Name.Name, "translationTransform", "name mismatch");
}
[Test]
public void TestProtocolConformanceDescriptor ()
{
var tld = Decomposer.Decompose ("_$s7XamGlue18xam_proxy_HashableCSQAAMc", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlprot = tld as TLProtocolConformanceDescriptor;
- Assert.IsNotNull (tlprot, "not a protocol conformance descriptor");
- Assert.IsNotNull (tlprot.ImplementingType, "no class");
+ ClassicAssert.IsNotNull (tlprot, "not a protocol conformance descriptor");
+ ClassicAssert.IsNotNull (tlprot.ImplementingType, "no class");
var cl = tlprot.ImplementingType as SwiftClassType;
- Assert.IsNotNull (cl);
- Assert.AreEqual ("XamGlue.xam_proxy_Hashable", cl.ClassName.ToFullyQualifiedName (), "wrong implementor");
- Assert.AreEqual ("Swift.Equatable", tlprot.Protocol.ClassName.ToFullyQualifiedName (), "wrong protocol");
+ ClassicAssert.IsNotNull (cl);
+ ClassicAssert.AreEqual ("XamGlue.xam_proxy_Hashable", cl.ClassName.ToFullyQualifiedName (), "wrong implementor");
+ ClassicAssert.AreEqual ("Swift.Equatable", tlprot.Protocol.ClassName.ToFullyQualifiedName (), "wrong protocol");
}
[Test]
public void TestTypeAlias ()
{
var tld = Decomposer.Decompose ("_$s13NSObjectTests21SomeVirtualClassmacOSC13StringVersion1vSSSo017NSOperatingSystemH0a_tF", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
var onlyArg = tlf.Signature.GetParameter (0) as SwiftClassType;
- Assert.IsNotNull (onlyArg, "not a class type arg");
- Assert.AreEqual ("Foundation.OperatingSystemVersion", onlyArg.ClassName.ToFullyQualifiedName (), "name mistmatch");
+ ClassicAssert.IsNotNull (onlyArg, "not a class type arg");
+ ClassicAssert.AreEqual ("Foundation.OperatingSystemVersion", onlyArg.ClassName.ToFullyQualifiedName (), "name mistmatch");
}
@@ -1139,31 +1140,31 @@ public void TestTypeAlias ()
public void TestPropertyExtension ()
{
var tld = Decomposer.Decompose ("_$sSf10CircleMenuE7degreesSfvpMV", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLPropertyDescriptor;
- Assert.IsNotNull (tlf, "not a property descriptor");
- Assert.IsNotNull (tlf.ExtensionOn, "no extension");
- Assert.IsNull (tlf.Class, "has a class?!");
+ ClassicAssert.IsNotNull (tlf, "not a property descriptor");
+ ClassicAssert.IsNotNull (tlf.ExtensionOn, "no extension");
+ ClassicAssert.IsNull (tlf.Class, "has a class?!");
}
[Test]
public void TestFieldOffsetExtension ()
{
var tld = Decomposer.Decompose ("_$s5Macaw16SWXMLHashOptionsC8encodingSS10FoundationE8EncodingVvpWvd", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFieldOffset;
- Assert.IsNotNull (tlf, "wrong type");
+ ClassicAssert.IsNotNull (tlf, "wrong type");
}
[Test]
public void TestUIColorExtension0 ()
{
var tld = Decomposer.Decompose ("_$sSo7UIColorC3HueE3hexABSS_tcfC", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
- Assert.IsTrue (tlf.Signature.IsConstructor, "not a constructor");
- Assert.IsNotNull (tlf.Signature.ExtensionOn, "no extension");
+ ClassicAssert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsTrue (tlf.Signature.IsConstructor, "not a constructor");
+ ClassicAssert.IsNotNull (tlf.Signature.ExtensionOn, "no extension");
}
@@ -1171,62 +1172,62 @@ public void TestUIColorExtension0 ()
public void TestUIColorExtension1 ()
{
var tld = Decomposer.Decompose ("_$sSo7UIColorC8MaterialE4argbABs6UInt32V_tcfC", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
- Assert.IsTrue (tlf.Signature.IsConstructor, "not a constructor");
- Assert.IsNotNull (tlf.Signature.ExtensionOn, "no extension");
+ ClassicAssert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsTrue (tlf.Signature.IsConstructor, "not a constructor");
+ ClassicAssert.IsNotNull (tlf.Signature.ExtensionOn, "no extension");
}
[Test]
public void TestUIColorExtension2 ()
{
var tld = Decomposer.Decompose ("_$sSo7UIColorC12DynamicColorE3hue10saturation9lightness5alphaAB12CoreGraphics7CGFloatV_A3JtcfC", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
- Assert.IsTrue (tlf.Signature.IsConstructor, "not a constructor");
- Assert.IsNotNull (tlf.Signature.ExtensionOn, "no extension");
+ ClassicAssert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsTrue (tlf.Signature.IsConstructor, "not a constructor");
+ ClassicAssert.IsNotNull (tlf.Signature.ExtensionOn, "no extension");
}
[Test]
public void TestProtocolRequirementsDescriptor0 ()
{
var tld = Decomposer.Decompose ("_$s14DateTimePicker0abC8DelegateTL", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLProtocolRequirementsBaseDescriptor;
- Assert.IsNotNull (tlf, "not a protocol requirements base descriptor");
- Assert.AreEqual ("DateTimePicker.DateTimePickerDelegate", tlf.Class.ClassName.ToFullyQualifiedName (true), "wrong name");
+ ClassicAssert.IsNotNull (tlf, "not a protocol requirements base descriptor");
+ ClassicAssert.AreEqual ("DateTimePicker.DateTimePickerDelegate", tlf.Class.ClassName.ToFullyQualifiedName (true), "wrong name");
}
[Test]
public void TestProtocolRequirementsDescriptor1 ()
{
var tld = Decomposer.Decompose ("_$s4Neon9FrameableTL", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLProtocolRequirementsBaseDescriptor;
- Assert.IsNotNull (tlf, "not a protocol requirements base descriptor");
- Assert.AreEqual ("Neon.Frameable", tlf.Class.ClassName.ToFullyQualifiedName (true), "wrong name");
+ ClassicAssert.IsNotNull (tlf, "not a protocol requirements base descriptor");
+ ClassicAssert.AreEqual ("Neon.Frameable", tlf.Class.ClassName.ToFullyQualifiedName (true), "wrong name");
}
[Test]
public void TestNREInMacaw ()
{
var tld = Decomposer.Decompose ("_$s5Macaw5ShapeC11interpolate_8progressACXDAC_SdtF", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
- Assert.AreEqual ("interpolate", tlf.Signature.Name.Name, "wrong name");
+ ClassicAssert.IsNotNull (tlf, "not a function");
+ ClassicAssert.AreEqual ("interpolate", tlf.Signature.Name.Name, "wrong name");
}
public void BaseReqTest (string mangle, string protoName, string reqName)
{
var tld = Decomposer.Decompose (mangle, false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLBaseConformanceDescriptor;
- Assert.IsNotNull (tlf, "not a base conformance descriptor");
- Assert.AreEqual (protoName, tlf.Class.ClassName.ToFullyQualifiedName (true), "wrong name");
- Assert.AreEqual (reqName, tlf.ProtocolRequirement.ClassName.ToFullyQualifiedName (true), "wrong requirement");
+ ClassicAssert.IsNotNull (tlf, "not a base conformance descriptor");
+ ClassicAssert.AreEqual (protoName, tlf.Class.ClassName.ToFullyQualifiedName (true), "wrong name");
+ ClassicAssert.AreEqual (reqName, tlf.ProtocolRequirement.ClassName.ToFullyQualifiedName (true), "wrong requirement");
}
[Test]
@@ -1245,578 +1246,578 @@ public void TestProtocolRequirementDescriptor3 ()
public void TestSubscriptDescriptor ()
{
var tld = Decomposer.Decompose ("_$s5Macaw10XMLIndexerOyACSicipMV", false);
- Assert.IsNotNull (tld, "failed descriptor");
+ ClassicAssert.IsNotNull (tld, "failed descriptor");
}
[Test]
public void TestFieldOffsetContainsClass ()
{
var tld = Decomposer.Decompose ("_$s5Macaw13ChangeHandlerC6handleyyxcvpWvd", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var fieldOffset = tld as TLFieldOffset;
- Assert.IsNotNull (fieldOffset, "field offset");
+ ClassicAssert.IsNotNull (fieldOffset, "field offset");
var cl = fieldOffset.Class;
- Assert.IsNotNull (cl, "null class");
+ ClassicAssert.IsNotNull (cl, "null class");
}
[Test]
public void TestPrivateInitializer0 ()
{
var tld = Decomposer.Decompose ("_$s6Eureka9_AlertRowC0029presentationModestorage_rAFJh33_D25096F98D3944FE1BCE11D750532E6DLLAA16PresentationModeOyAA08SelectorB10ControllerCyACyxGGGSgSgvpfi", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
}
[Test]
public void TestPrivateInitializer1 ()
{
var tld = Decomposer.Decompose ("_$s15JTAppleCalendar0aB4ViewC0020theDatastorage_mdAJd33_70DF286E0E62C56975265F8CF5A8FF56LLAA0B4DataVSgvpfi", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
}
[Test]
public void TestPrivateInitializer2 ()
{
var tld = Decomposer.Decompose ("_$s8Presentr0A10ControllerC0030shouldSwipeBottomstorage_cDAEi33_9D6ACB2CCC4A4980BDBB65F0F301220BLLSbSgvpfi", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
}
[Test]
public void TestExtensionInit ()
{
var tld = Decomposer.Decompose ("_$sSd6EurekaE6stringSdSgSS_tcfC", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
- Assert.IsNotNull (tlf.Signature.ExtensionOn, "no extension?");
+ ClassicAssert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf.Signature.ExtensionOn, "no extension?");
var swiftClassType = tlf.Signature.ExtensionOn as SwiftClassType;
- Assert.IsNotNull (swiftClassType, "extension is not a class?");
- Assert.AreEqual ("Swift.Double", swiftClassType.ClassName.ToFullyQualifiedName (), "bad name");
+ ClassicAssert.IsNotNull (swiftClassType, "extension is not a class?");
+ ClassicAssert.AreEqual ("Swift.Double", swiftClassType.ClassName.ToFullyQualifiedName (), "bad name");
}
[Test]
public void TestVarInInitializer0 ()
{
var tld = Decomposer.Decompose ("_$s6Eureka22_TriplePickerInlineRowC13secondOptionsySayq_Gxcvpfi", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
}
[Test]
public void TestVarInInitializer1 ()
{
var tld = Decomposer.Decompose ("_$s6Eureka22_TriplePickerInlineRowC12thirdOptionsySayq0_Gx_q_tcvpfi", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
}
[Test]
public void TestVarInInitializer2 ()
{
var tld = Decomposer.Decompose ("_$s6Eureka22_DoublePickerInlineRowC13secondOptionsySayq_Gxcvpfi", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
}
[Test]
public void TestVarInInitializer3 ()
{
var tld = Decomposer.Decompose ("_$s11PaperSwitch08RAMPaperB0C24animationDidStartClosureyySbcvpfi", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
}
[Test]
public void TestVarInInitializer4 ()
{
var tld = Decomposer.Decompose ("_$s11PaperSwitch08RAMPaperB0C23animationDidStopClosureyySb_Sbtcvpfi", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
}
[Test]
public void TestClosureDescriptor ()
{
var tld = Decomposer.Decompose ("_$s9FaceAware14ClosureWrapperC7closureyyxcvsTq", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
}
[Test]
public void TestClosurePropertyDesc ()
{
var tld = Decomposer.Decompose ("_$s18XLActionController8CellSpecO6heighty12CoreGraphics7CGFloatVq_cvg", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
}
[Test]
public void TestStaticVariable ()
{
var tld = Decomposer.Decompose ("_$s8Material5ThemeV4fontAA8FontType_pXpvMZ", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
- Assert.AreEqual ("font", tlf.Name.Name);
+ ClassicAssert.IsNotNull (tlf, "not a function");
+ ClassicAssert.AreEqual ("font", tlf.Name.Name);
}
[Test]
public void TestStaticAddressorVariable ()
{
var tld = Decomposer.Decompose ("_$s8Material5ThemeV4fontAA8FontType_pXpvau", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlu = tld as TLUnsafeMutableAddressor;
- Assert.IsNotNull (tlu, "not an addressor");
- Assert.AreEqual ("font", tlu.Name.Name);
+ ClassicAssert.IsNotNull (tlu, "not an addressor");
+ ClassicAssert.AreEqual ("font", tlu.Name.Name);
}
[Test]
public void TestStaticVariable1 ()
{
var tld = Decomposer.Decompose ("_$s8Material5ThemeV4fontAA8FontType_pXpvpZ", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLVariable;
- Assert.IsNotNull (tlf, "not a function");
- Assert.AreEqual ("font", tlf.Name.Name);
+ ClassicAssert.IsNotNull (tlf, "not a function");
+ ClassicAssert.AreEqual ("font", tlf.Name.Name);
}
[Test]
public void TestPATReference ()
{
var tld = Decomposer.Decompose ("_$s24ProtocolConformanceTests9doSetProp1a1byxz_4ItemQztAA9Simplest3RzlF", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
var arg2 = tlf.Signature.GetParameter (1) as SwiftGenericArgReferenceType;
- Assert.IsNotNull (arg2, "Not an SLGenericReference");
- Assert.IsTrue (arg2.HasAssociatedTypePath, "No associated type path");
- Assert.AreEqual (1, arg2.AssociatedTypePath.Count, "wrong number of assoc type path elements");
- Assert.AreEqual ("Item", arg2.AssociatedTypePath [0], "Mismatch in assoc type name");
+ ClassicAssert.IsNotNull (arg2, "Not an SLGenericReference");
+ ClassicAssert.IsTrue (arg2.HasAssociatedTypePath, "No associated type path");
+ ClassicAssert.AreEqual (1, arg2.AssociatedTypePath.Count, "wrong number of assoc type path elements");
+ ClassicAssert.AreEqual ("Item", arg2.AssociatedTypePath [0], "Mismatch in assoc type name");
}
[Test]
public void TestPATPathReference ()
{
var tld = Decomposer.Decompose ("_$s15BadAssociations7doPrint1a1byx_5Thing_4NameQZtAA13PrintableItemRzlF", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
var arg2 = tlf.Signature.GetParameter (1) as SwiftGenericArgReferenceType;
- Assert.IsNotNull (arg2, "Not an SLGenericReference");
- Assert.IsTrue (arg2.HasAssociatedTypePath, "No associated type path");
- Assert.AreEqual (2, arg2.AssociatedTypePath.Count, "wrong number of assoc type path elements");
- Assert.AreEqual ("Thing", arg2.AssociatedTypePath [0], "Mismatch in assoc type name 0");
- Assert.AreEqual ("Name", arg2.AssociatedTypePath [1], "Mismatch in assoc type name 1");
+ ClassicAssert.IsNotNull (arg2, "Not an SLGenericReference");
+ ClassicAssert.IsTrue (arg2.HasAssociatedTypePath, "No associated type path");
+ ClassicAssert.AreEqual (2, arg2.AssociatedTypePath.Count, "wrong number of assoc type path elements");
+ ClassicAssert.AreEqual ("Thing", arg2.AssociatedTypePath [0], "Mismatch in assoc type name 0");
+ ClassicAssert.AreEqual ("Name", arg2.AssociatedTypePath [1], "Mismatch in assoc type name 1");
}
[Test]
public void TestGenericMetatype ()
{
var tld = Decomposer.Decompose ("_$sSD14ExtensionTestsE5value6forKey6ofTypeqd__SgSS_qd__mtlF", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
var arg0 = tlf.Signature.GetParameter (0) as SwiftClassType;
- Assert.IsNotNull (arg0, "not a swift class type at arg0");
+ ClassicAssert.IsNotNull (arg0, "not a swift class type at arg0");
var arg1 = tlf.Signature.GetParameter (1) as SwiftMetaClassType;
- Assert.IsNotNull (arg1, "not a metaclass type");
- Assert.IsNotNull (arg1.ClassGenericReference, "not a generic reference metatype");
+ ClassicAssert.IsNotNull (arg1, "not a metaclass type");
+ ClassicAssert.IsNotNull (arg1.ClassGenericReference, "not a generic reference metatype");
}
[Test]
public void TestProtocolList0 ()
{
var tld = Decomposer.Decompose ("_$s6Lottie10StrokeNodeC11propertyMapAA17KeypathSearchable_AA0c8PropertyE0pvg", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
var ret = tlf.Signature.ReturnType as SwiftProtocolListType;
- Assert.IsNotNull (ret, "not a protocol list");
- Assert.AreEqual (2, ret.Protocols.Count);
+ ClassicAssert.IsNotNull (ret, "not a protocol list");
+ ClassicAssert.AreEqual (2, ret.Protocols.Count);
}
[Test]
public void TestProtocolList1 ()
{
var tld = Decomposer.Decompose ("_$s6Lottie10StrokeNodeC11propertyMapAA17KeypathSearchable_AA0c8PropertyE0pvgTq", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
var ret = tlf.Signature.ReturnType as SwiftProtocolListType;
- Assert.IsNotNull (ret, "not a protocol list");
- Assert.AreEqual (2, ret.Protocols.Count);
+ ClassicAssert.IsNotNull (ret, "not a protocol list");
+ ClassicAssert.AreEqual (2, ret.Protocols.Count);
}
[Test]
public void TestProtocolList2 ()
{
var tld = Decomposer.Decompose ("_$s6Lottie10StrokeNodeC11propertyMapAA17KeypathSearchable_AA0c8PropertyE0pvpMV", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLPropertyDescriptor;
- Assert.IsNotNull (tlf, "not a prop descriptor");
+ ClassicAssert.IsNotNull (tlf, "not a prop descriptor");
var proptype = tlf.OfType as SwiftProtocolListType;
- Assert.IsNotNull (proptype);
- Assert.AreEqual (2, proptype.Protocols.Count);
+ ClassicAssert.IsNotNull (proptype);
+ ClassicAssert.AreEqual (2, proptype.Protocols.Count);
}
[Test]
public void TestProtocolList3 ()
{
var tld = Decomposer.Decompose ("_$s6Lottie10StrokeNodeC8rendererAA0C6Output_AA10Renderablepvg", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
var ret = tlf.Signature.ReturnType as SwiftProtocolListType;
- Assert.IsNotNull (ret, "not a protocol list");
- Assert.AreEqual (2, ret.Protocols.Count);
+ ClassicAssert.IsNotNull (ret, "not a protocol list");
+ ClassicAssert.AreEqual (2, ret.Protocols.Count);
}
[Test]
public void TestProtocolList4 ()
{
var tld = Decomposer.Decompose ("_$s6Lottie10StrokeNodeC8rendererAA0C6Output_AA10RenderablepvgTq", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
var ret = tlf.Signature.ReturnType as SwiftProtocolListType;
- Assert.IsNotNull (ret, "not a protocol list");
- Assert.AreEqual (2, ret.Protocols.Count);
+ ClassicAssert.IsNotNull (ret, "not a protocol list");
+ ClassicAssert.AreEqual (2, ret.Protocols.Count);
}
[Test]
public void TestProtocolList5 ()
{
var tld = Decomposer.Decompose ("_$s6Lottie10StrokeNodeC8rendererAA0C6Output_AA10RenderablepvpMV", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLPropertyDescriptor;
- Assert.IsNotNull (tlf, "not a prop descriptor");
+ ClassicAssert.IsNotNull (tlf, "not a prop descriptor");
var proptype = tlf.OfType as SwiftProtocolListType;
- Assert.IsNotNull (proptype);
- Assert.AreEqual (2, proptype.Protocols.Count);
+ ClassicAssert.IsNotNull (proptype);
+ ClassicAssert.AreEqual (2, proptype.Protocols.Count);
}
[Test]
public void TestProtocolList6 ()
{
var tld = Decomposer.Decompose ("_$s6Lottie11EllipseNodeC11propertyMapAA17KeypathSearchable_AA0c8PropertyE0pvg", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
var ret = tlf.Signature.ReturnType as SwiftProtocolListType;
- Assert.IsNotNull (ret, "not a protocol list");
- Assert.AreEqual (2, ret.Protocols.Count);
+ ClassicAssert.IsNotNull (ret, "not a protocol list");
+ ClassicAssert.AreEqual (2, ret.Protocols.Count);
}
[Test]
public void TestProtocolList7 ()
{
var tld = Decomposer.Decompose ("_$s6Lottie11EllipseNodeC11propertyMapAA17KeypathSearchable_AA0c8PropertyE0pvgTq", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
var ret = tlf.Signature.ReturnType as SwiftProtocolListType;
- Assert.IsNotNull (ret, "not a protocol list");
- Assert.AreEqual (2, ret.Protocols.Count);
+ ClassicAssert.IsNotNull (ret, "not a protocol list");
+ ClassicAssert.AreEqual (2, ret.Protocols.Count);
}
[Test]
public void TestProtocolList8 ()
{
var tld = Decomposer.Decompose ("_$s6Lottie11EllipseNodeC11propertyMapAA17KeypathSearchable_AA0c8PropertyE0pvpMV", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLPropertyDescriptor;
- Assert.IsNotNull (tlf, "not a prop descriptor");
+ ClassicAssert.IsNotNull (tlf, "not a prop descriptor");
var proptype = tlf.OfType as SwiftProtocolListType;
- Assert.IsNotNull (proptype);
- Assert.AreEqual (2, proptype.Protocols.Count);
+ ClassicAssert.IsNotNull (proptype);
+ ClassicAssert.AreEqual (2, proptype.Protocols.Count);
}
[Test]
public void TestProtocolList9 ()
{
var tld = Decomposer.Decompose ("_$s6Lottie11PolygonNodeC11propertyMapAA17KeypathSearchable_AA0c8PropertyE0pvg", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
var ret = tlf.Signature.ReturnType as SwiftProtocolListType;
- Assert.IsNotNull (ret, "not a protocol list");
- Assert.AreEqual (2, ret.Protocols.Count);
+ ClassicAssert.IsNotNull (ret, "not a protocol list");
+ ClassicAssert.AreEqual (2, ret.Protocols.Count);
}
[Test]
public void TestProtocolList10 ()
{
var tld = Decomposer.Decompose ("_$s6Lottie11PolygonNodeC11propertyMapAA17KeypathSearchable_AA0c8PropertyE0pvgTq", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
var ret = tlf.Signature.ReturnType as SwiftProtocolListType;
- Assert.IsNotNull (ret, "not a protocol list");
- Assert.AreEqual (2, ret.Protocols.Count);
+ ClassicAssert.IsNotNull (ret, "not a protocol list");
+ ClassicAssert.AreEqual (2, ret.Protocols.Count);
}
[Test]
public void VariableInitializationExpression0 ()
{
var tld = Decomposer.Decompose ("_$s8Presentr0A10ControllerC0027shouldSwipeTopstorage_mvFAh33_9D6ACB2CCC4A4980BDBB65F0F301220BLLSbSgvpfi", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
}
[Test]
public void VariableInitializationExpression1 ()
{
var tld = Decomposer.Decompose ("_$s8Presentr0A10ControllerC0030shouldSwipeBottomstorage_cDAEi33_9D6ACB2CCC4A4980BDBB65F0F301220BLLSbSgvpfi", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
}
[Test]
public void VariableInitializationExpression2 ()
{
var tld = Decomposer.Decompose ("_$s8Presentr0A10ControllerC0030shouldSwipeBottomstorage_cDAEi33_9D6ACB2CCC4A4980BDBB65F0F301220BLLSbSgvpfi", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "not a function");
+ ClassicAssert.IsNotNull (tlf, "not a function");
}
[Test]
public void MethodDescriptor0 ()
{
var tld = Decomposer.Decompose ("_$s8Presentr0A10ControllerC013presentedViewB0010presentingdB016presentationType12roundCorners12cornerRadius10dropShadow13backgroundTap14dismissOnSwipe0pqR9Direction0N5Color0N7Opacity14blurBackground0V5Style06customwD0019keyboardTranslationG00P8Animated27contextFrameForPresentation014outsideContextO0ACSo06UIViewB0C_AWSgAA012PresentationG0OSbSg12CoreGraphics7CGFloatVAA0aM0VSgAA0wO6ActionOSbAA07DismissrS0OSo7UIColorCSfSbSo012UIBlurEffectX0VSo6UIViewCSgAA019KeyboardTranslationG0OSbSo6CGRectVSgA7_tcfCTq", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var methodDesc = tld as TLMethodDescriptor;
- Assert.IsNotNull (methodDesc, "not a method descriptor");
+ ClassicAssert.IsNotNull (methodDesc, "not a method descriptor");
}
[Test]
public void TestExtensionDescriptor ()
{
var tld = Decomposer.Decompose ("_$sSi16MySwiftFrameworkE8timesTwoSivpMV", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var pd = tld as TLPropertyDescriptor;
- Assert.IsNotNull (pd, "not a property descriptor");
- Assert.IsNotNull (pd.ExtensionOn, "no extension");
+ ClassicAssert.IsNotNull (pd, "not a property descriptor");
+ ClassicAssert.IsNotNull (pd.ExtensionOn, "no extension");
var onType = pd.ExtensionOn as SwiftBuiltInType;
- Assert.IsNotNull (onType, "not a built in type");
- Assert.AreEqual (CoreBuiltInType.Int, onType.BuiltInType, "not an int");
+ ClassicAssert.IsNotNull (onType, "not a built in type");
+ ClassicAssert.AreEqual (CoreBuiltInType.Int, onType.BuiltInType, "not an int");
}
[Test]
public void TestReflectionMetadataField ()
{
var tld = Decomposer.Decompose ("_$s8itsAFive2E2OMF", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var mdd = tld as TLMetadataDescriptor;
- Assert.IsNotNull (mdd, "not a metadata descriptor");
+ ClassicAssert.IsNotNull (mdd, "not a metadata descriptor");
var cl = mdd.OfType as SwiftClassType;
- Assert.IsNotNull (cl, "not a class");
- Assert.AreEqual ("itsAFive.E2", cl.ClassName.ToFullyQualifiedName (), "wrong name");
+ ClassicAssert.IsNotNull (cl, "not a class");
+ ClassicAssert.AreEqual ("itsAFive.E2", cl.ClassName.ToFullyQualifiedName (), "wrong name");
}
[Test]
public void TestReflectionMetadataBuiltin ()
{
var tld = Decomposer.Decompose ("_$s8itsAFive2E2OMB", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var mdd = tld as TLMetadataDescriptor;
- Assert.IsNotNull (mdd, "not a metadata descriptor");
- Assert.IsTrue (mdd.IsBuiltIn, "not built in");
+ ClassicAssert.IsNotNull (mdd, "not a metadata descriptor");
+ ClassicAssert.IsTrue (mdd.IsBuiltIn, "not built in");
var cl = mdd.OfType as SwiftClassType;
- Assert.IsNotNull (cl, "not a class");
- Assert.AreEqual ("itsAFive.E2", cl.ClassName.ToFullyQualifiedName (), "wrong name");
+ ClassicAssert.IsNotNull (cl, "not a class");
+ ClassicAssert.AreEqual ("itsAFive.E2", cl.ClassName.ToFullyQualifiedName (), "wrong name");
}
[Test]
public void TestBaseConformanceDescriptor ()
{
var tld = Decomposer.Decompose ("_$sSHSQTb", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var bcd = tld as TLBaseConformanceDescriptor;
- Assert.IsNotNull (bcd, "not a conformance descriptor");
+ ClassicAssert.IsNotNull (bcd, "not a conformance descriptor");
var cl = bcd.ProtocolRequirement as SwiftClassType;
- Assert.IsNotNull (cl, "not a class");
- Assert.AreEqual ("Swift.Equatable", cl.ClassName.ToFullyQualifiedName (), "wrong name");
+ ClassicAssert.IsNotNull (cl, "not a class");
+ ClassicAssert.AreEqual ("Swift.Equatable", cl.ClassName.ToFullyQualifiedName (), "wrong name");
}
[Test]
public void TestAssociatedTypeDescriptor0 ()
{
var tld = Decomposer.Decompose ("_$s12RowValueType6Eureka04RuleC0PTl", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var atdesc = tld as TLAssociatedTypeDescriptor;
- Assert.IsNotNull (atdesc, "not an associated type desc");
- Assert.AreEqual ("RowValueType", atdesc.AssociatedTypeName.Name, "wrong associated type name");
- Assert.AreEqual ("Eureka.RuleType", atdesc.Class.ClassName.ToFullyQualifiedName (), "protocol name mismatch");
+ ClassicAssert.IsNotNull (atdesc, "not an associated type desc");
+ ClassicAssert.AreEqual ("RowValueType", atdesc.AssociatedTypeName.Name, "wrong associated type name");
+ ClassicAssert.AreEqual ("Eureka.RuleType", atdesc.Class.ClassName.ToFullyQualifiedName (), "protocol name mismatch");
}
[Test]
public void TestAssociatedTypeDescriptor1 ()
{
var tld = Decomposer.Decompose ("_$s23PresentedControllerType6Eureka012PresenterRowC0PTl", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var atdesc = tld as TLAssociatedTypeDescriptor;
- Assert.IsNotNull (atdesc, "not an associated type desc");
- Assert.AreEqual ("PresentedControllerType", atdesc.AssociatedTypeName.Name, "wrong associated type name");
- Assert.AreEqual ("Eureka.PresenterRowType", atdesc.Class.ClassName.ToFullyQualifiedName (), "protocol name mismatch");
+ ClassicAssert.IsNotNull (atdesc, "not an associated type desc");
+ ClassicAssert.AreEqual ("PresentedControllerType", atdesc.AssociatedTypeName.Name, "wrong associated type name");
+ ClassicAssert.AreEqual ("Eureka.PresenterRowType", atdesc.Class.ClassName.ToFullyQualifiedName (), "protocol name mismatch");
}
[Test]
public void TestAssociatedTypeDescriptor2 ()
{
var tld = Decomposer.Decompose ("_$s9InlineRow6Eureka0aB4TypePTl", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var atdesc = tld as TLAssociatedTypeDescriptor;
- Assert.IsNotNull (atdesc, "not an associated type desc");
- Assert.AreEqual ("InlineRow", atdesc.AssociatedTypeName.Name, "wrong associated type name");
- Assert.AreEqual ("Eureka.InlineRowType", atdesc.Class.ClassName.ToFullyQualifiedName (), "protocol name mismatch");
+ ClassicAssert.IsNotNull (atdesc, "not an associated type desc");
+ ClassicAssert.AreEqual ("InlineRow", atdesc.AssociatedTypeName.Name, "wrong associated type name");
+ ClassicAssert.AreEqual ("Eureka.InlineRowType", atdesc.Class.ClassName.ToFullyQualifiedName (), "protocol name mismatch");
}
[Test]
public void TestMoreMethodDescriptor0 ()
{
var tld = Decomposer.Decompose ("_$s14ClassWrapTests10GarbleWCRCCACycfCTq", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var md = tld as TLMethodDescriptor;
- Assert.IsNotNull (md, "not a method descriptor");
- Assert.AreEqual ("GarbleWCRC", md.Name.Name, "name mismatch");
+ ClassicAssert.IsNotNull (md, "not a method descriptor");
+ ClassicAssert.AreEqual ("GarbleWCRC", md.Name.Name, "name mismatch");
}
[Test]
public void TestMoreMethodDescriptor1 ()
{
var tld = Decomposer.Decompose ("_$s14ClassWrapTests11MontyWMMIntCACycfCTq", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var md = tld as TLMethodDescriptor;
- Assert.IsNotNull (md, "not a method descriptor");
- Assert.AreEqual ("MontyWMMInt", md.Name.Name, "name mismatch");
+ ClassicAssert.IsNotNull (md, "not a method descriptor");
+ ClassicAssert.AreEqual ("MontyWMMInt", md.Name.Name, "name mismatch");
}
[Test]
public void TestMoreMethodDescriptor2 ()
{
var tld = Decomposer.Decompose ("_$s14ClassWrapTests11MontyWSMIntCACycfCTq", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var md = tld as TLMethodDescriptor;
- Assert.IsNotNull (md, "not a method descriptor");
- Assert.AreEqual ("MontyWSMInt", md.Name.Name, "name mismatch");
+ ClassicAssert.IsNotNull (md, "not a method descriptor");
+ ClassicAssert.AreEqual ("MontyWSMInt", md.Name.Name, "name mismatch");
}
[Test]
public void TestMoreMethodDescriptor3 ()
{
var tld = Decomposer.Decompose ("_$s14ClassWrapTests11MontyWSPIntCACycfCTq", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var md = tld as TLMethodDescriptor;
- Assert.IsNotNull (md, "not a method descriptor");
- Assert.AreEqual ("MontyWSPInt", md.Name.Name, "name mismatch");
+ ClassicAssert.IsNotNull (md, "not a method descriptor");
+ ClassicAssert.AreEqual ("MontyWSPInt", md.Name.Name, "name mismatch");
}
[Test]
public void TestMorePropertyDescriptor0 ()
{
var tld = Decomposer.Decompose ("_$s14ClassWrapTests11MontyWSPIntC3valSivpMV", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var pd = tld as TLPropertyDescriptor;
- Assert.IsNotNull (pd, "not a property descriptor");
- Assert.AreEqual ("val", pd.Name.Name, "name mismatch");
+ ClassicAssert.IsNotNull (pd, "not a property descriptor");
+ ClassicAssert.AreEqual ("val", pd.Name.Name, "name mismatch");
}
[Test]
public void TestPropertyThunk ()
{
var tld = Decomposer.Decompose ("_$s7CanFind3BarC1xSbvgTj", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "null function");
+ ClassicAssert.IsNotNull (tlf, "null function");
var getter = tlf.Signature as SwiftPropertyThunkType;
- Assert.IsNotNull (getter, "not a property");
- Assert.AreEqual (PropertyType.Getter, getter.PropertyType, "not a getter");
- Assert.AreEqual ("x", getter.Name.Name, "wrong name");
+ ClassicAssert.IsNotNull (getter, "not a property");
+ ClassicAssert.AreEqual (PropertyType.Getter, getter.PropertyType, "not a getter");
+ ClassicAssert.AreEqual ("x", getter.Name.Name, "wrong name");
}
[Test]
public void TestStaticFuncThunk ()
{
var tld = Decomposer.Decompose ("_$s21NewClassCompilerTests06Publicb4OpenB15MethodBoolFalseC5thingSbyFZTj", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "null function");
+ ClassicAssert.IsNotNull (tlf, "null function");
var func = tlf.Signature as SwiftStaticFunctionThunkType;
- Assert.IsNotNull (func, "not a static thunk func");
- Assert.AreEqual ("thing", func.Name.Name, "wrong name");
- Assert.AreEqual (0, func.ParameterCount, "wrong parameter count");
+ ClassicAssert.IsNotNull (func, "not a static thunk func");
+ ClassicAssert.AreEqual ("thing", func.Name.Name, "wrong name");
+ ClassicAssert.AreEqual (0, func.ParameterCount, "wrong parameter count");
var ret = func.ReturnType as SwiftBuiltInType;
- Assert.IsNotNull (ret, "wrong return type");
- Assert.AreEqual (CoreBuiltInType.Bool, ret.BuiltInType, "not a bool");
+ ClassicAssert.IsNotNull (ret, "wrong return type");
+ ClassicAssert.AreEqual (CoreBuiltInType.Bool, ret.BuiltInType, "not a bool");
}
[Test]
public void TestAllocatorMethodDispatchThunk ()
{
var tld = Decomposer.Decompose ("_$s8HelloMod0A0CACycfCTj", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLFunction;
- Assert.IsNotNull (tlf, "null function");
+ ClassicAssert.IsNotNull (tlf, "null function");
var func = tlf.Signature as SwiftConstructorThunkType;
- Assert.IsNotNull (func, "not a thunk type");
+ ClassicAssert.IsNotNull (func, "not a thunk type");
var ret = func.ReturnType as SwiftClassType;
- Assert.IsNotNull (ret, "not a class type");
- Assert.AreEqual ("HelloMod.Hello", ret.ClassName.ToFullyQualifiedName (), "wrong class name");
- Assert.AreEqual (0, func.ParameterCount, "parameters?");
+ ClassicAssert.IsNotNull (ret, "not a class type");
+ ClassicAssert.AreEqual ("HelloMod.Hello", ret.ClassName.ToFullyQualifiedName (), "wrong class name");
+ ClassicAssert.AreEqual (0, func.ParameterCount, "parameters?");
}
[Test]
public void TestClassMetadataOffset ()
{
var tld = Decomposer.Decompose ("_$s8HelloMod0A0CMo", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLMetadataBaseOffset;
- Assert.IsNotNull (tlf, "not a metadata offset");
- Assert.AreEqual ("HelloMod.Hello", tlf.Class.ClassName.ToFullyQualifiedName (), "wrong class name");
+ ClassicAssert.IsNotNull (tlf, "not a metadata offset");
+ ClassicAssert.AreEqual ("HelloMod.Hello", tlf.Class.ClassName.ToFullyQualifiedName (), "wrong class name");
}
[Test]
public void TestMethodLookupFunction ()
{
var tld = Decomposer.Decompose ("_$s8HelloMod0A0CMu", false);
- Assert.NotNull (tld, "failed decomposition");
+ ClassicAssert.NotNull (tld, "failed decomposition");
}
[Test]
public void TestUnusualEnumCase0 ()
{
var tld = Decomposer.Decompose ("_$s7Sampler6NumberO4RealyACSdcACmFWC", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLEnumCase;
- Assert.IsNotNull (tlf, "not an enum case");
+ ClassicAssert.IsNotNull (tlf, "not an enum case");
var func = tlf.Signature as SwiftUncurriedFunctionType;
- Assert.IsNotNull (func);
+ ClassicAssert.IsNotNull (func);
var instanceType = func.UncurriedParameter as SwiftClassType;
- Assert.IsNotNull (instanceType, "not a class in uncurried parameter");
- Assert.AreEqual ("Sampler.Number", instanceType.ClassName.ToFullyQualifiedName (), "wrong class name");
+ ClassicAssert.IsNotNull (instanceType, "not a class in uncurried parameter");
+ ClassicAssert.AreEqual ("Sampler.Number", instanceType.ClassName.ToFullyQualifiedName (), "wrong class name");
}
[Test]
public void TestUnusualEnumCase1 ()
{
var tld = Decomposer.Decompose ("_$s7Sampler6NumberO7IntegeryACSicACmFWC", false);
- Assert.IsNotNull (tld, "failed decomposition");
+ ClassicAssert.IsNotNull (tld, "failed decomposition");
var tlf = tld as TLEnumCase;
- Assert.IsNotNull (tlf, "not an enum case");
+ ClassicAssert.IsNotNull (tlf, "not an enum case");
var func = tlf.Signature as SwiftUncurriedFunctionType;
- Assert.IsNotNull (func);
+ ClassicAssert.IsNotNull (func);
var instanceType = func.UncurriedParameter as SwiftClassType;
- Assert.IsNotNull (instanceType, "not a class in uncurried parameter");
- Assert.AreEqual ("Sampler.Number", instanceType.ClassName.ToFullyQualifiedName (), "wrong class name");
+ ClassicAssert.IsNotNull (instanceType, "not a class in uncurried parameter");
+ ClassicAssert.AreEqual ("Sampler.Number", instanceType.ClassName.ToFullyQualifiedName (), "wrong class name");
}
}
}
diff --git a/tests/tom-swifty-test/SwiftReflector/SwiftModuleFinderTests.cs b/tests/tom-swifty-test/SwiftReflector/SwiftModuleFinderTests.cs
index 9eebd809..34777d61 100644
--- a/tests/tom-swifty-test/SwiftReflector/SwiftModuleFinderTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/SwiftModuleFinderTests.cs
@@ -9,6 +9,7 @@
using System.Collections.Generic;
using System.Linq;
using tomwiftytest;
+using NUnit.Framework.Legacy;
namespace SwiftReflector
{
@@ -31,10 +32,10 @@ public void GetAppleModuleName_OnlyWorksWithValidStructure ()
using (var tmp = new DisposableTempDirectory ()) {
string framework = Path.Combine (tmp.DirectoryPath, "Foo.framework");
Directory.CreateDirectory (Path.Combine (framework, "Modules"));
- Assert.IsNull (UniformTargetRepresentation.GetAppleModuleName (framework));
+ ClassicAssert.IsNull (UniformTargetRepresentation.GetAppleModuleName (framework));
File.Create (Path.Combine (framework, "Modules", "Foo.swiftmodule"));
- Assert.AreEqual ("Foo", UniformTargetRepresentation.GetAppleModuleName (framework));
+ ClassicAssert.AreEqual ("Foo", UniformTargetRepresentation.GetAppleModuleName (framework));
}
}
@@ -43,10 +44,10 @@ public void GetAppleModuleName_RequiresValidName ()
{
using (var tmp = new DisposableTempDirectory ()) {
CreateFileAtLocation (tmp.DirectoryPath, "Foo", "Modules", "Foo.swiftmodule");
- Assert.IsNull (UniformTargetRepresentation.GetAppleModuleName (Path.Combine (tmp.DirectoryPath, "Foo")));
+ ClassicAssert.IsNull (UniformTargetRepresentation.GetAppleModuleName (Path.Combine (tmp.DirectoryPath, "Foo")));
CreateFileAtLocation (tmp.DirectoryPath, ".framework", "Modules", ".swiftmodule");
- Assert.IsNull (UniformTargetRepresentation.GetAppleModuleName (Path.Combine (tmp.DirectoryPath, ".framework")));
+ ClassicAssert.IsNull (UniformTargetRepresentation.GetAppleModuleName (Path.Combine (tmp.DirectoryPath, ".framework")));
}
}
@@ -58,10 +59,10 @@ public void GetXamarinModuleName_OnlyWorksWithValidStructure ()
using (var tmp = new DisposableTempDirectory ()) {
string folder = Path.Combine (tmp.DirectoryPath, "Foo");
Directory.CreateDirectory (Path.Combine (folder, Arch));
- Assert.IsNull (UniformTargetRepresentation.GetXamarinModuleName (folder, Arch));
+ ClassicAssert.IsNull (UniformTargetRepresentation.GetXamarinModuleName (folder, Arch));
CreateFileAtLocation (folder, "x86_64", "Foo.swiftmodule");
- Assert.AreEqual ("Foo", UniformTargetRepresentation.GetXamarinModuleName (folder, Arch));
+ ClassicAssert.AreEqual ("Foo", UniformTargetRepresentation.GetXamarinModuleName (folder, Arch));
}
}
@@ -70,10 +71,10 @@ public void GetDirectLayoutModuleName ()
{
using (var tmp = new DisposableTempDirectory ()) {
CreateFileAtLocation (tmp.DirectoryPath, "Foo");
- Assert.IsNull (UniformTargetRepresentation.GetDirectLayoutModuleName (Path.Combine (tmp.DirectoryPath, "Foo")));
+ ClassicAssert.IsNull (UniformTargetRepresentation.GetDirectLayoutModuleName (Path.Combine (tmp.DirectoryPath, "Foo")));
CreateFileAtLocation (tmp.DirectoryPath, "Bar.swiftmodule");
- Assert.AreEqual ("Bar", UniformTargetRepresentation.GetDirectLayoutModuleName (Path.Combine (tmp.DirectoryPath, "Bar.swiftmodule")));
+ ClassicAssert.AreEqual ("Bar", UniformTargetRepresentation.GetDirectLayoutModuleName (Path.Combine (tmp.DirectoryPath, "Bar.swiftmodule")));
}
}
}
diff --git a/tests/tom-swifty-test/SwiftReflector/SwiftNameTests.cs b/tests/tom-swifty-test/SwiftReflector/SwiftNameTests.cs
index 262eec44..8613821c 100644
--- a/tests/tom-swifty-test/SwiftReflector/SwiftNameTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/SwiftNameTests.cs
@@ -7,6 +7,7 @@
using System.IO;
using NUnit.Framework;
using tomwiftytest;
+using NUnit.Framework.Legacy;
namespace SwiftReflector {
[TestFixture]
@@ -19,7 +20,7 @@ public void SwiftNameEquals ()
{
SwiftName sn = new SwiftName ("Bob", false);
SwiftName sn1 = new SwiftName ("Bob", false);
- Assert.AreEqual (sn, sn1);
+ ClassicAssert.AreEqual (sn, sn1);
}
[Test]
@@ -27,7 +28,7 @@ public void SwiftNameNotEquals ()
{
SwiftName sn = new SwiftName ("Bob", false);
SwiftName sn1 = new SwiftName ("Bob1", false);
- Assert.AreNotEqual (sn, sn1);
+ ClassicAssert.AreNotEqual (sn, sn1);
}
[Test]
@@ -35,7 +36,7 @@ public void SwiftNamePunyEquals ()
{
SwiftName sn = new SwiftName ("GrIh", true);
SwiftName sn1 = new SwiftName ("GrIh", true);
- Assert.AreEqual (sn, sn1);
+ ClassicAssert.AreEqual (sn, sn1);
}
[Test]
@@ -43,7 +44,7 @@ public void SwiftNamePunyNotEquals ()
{
SwiftName sn = new SwiftName ("GrIh", true);
SwiftName sn1 = new SwiftName ("Bob1", false);
- Assert.AreNotEqual (sn, sn1);
+ ClassicAssert.AreNotEqual (sn, sn1);
}
}
}
diff --git a/tests/tom-swifty-test/SwiftReflector/TypeDatabaseTests.cs b/tests/tom-swifty-test/SwiftReflector/TypeDatabaseTests.cs
index 41d548ab..1e051707 100644
--- a/tests/tom-swifty-test/SwiftReflector/TypeDatabaseTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/TypeDatabaseTests.cs
@@ -9,6 +9,7 @@
using SwiftReflector.TypeMapping;
using SwiftReflector;
using tomwiftytest;
+using NUnit.Framework.Legacy;
namespace SwiftReflector {
[TestFixture]
@@ -145,20 +146,20 @@ public void TestSwiftCoreOperator (string opName, OperatorType opType, string pr
{
var td = new TypeDatabase ();
var path = GetSwiftCoreDB ();
- Assert.IsNotNull (path, "couldn't find SwiftCore.xml!");
+ ClassicAssert.IsNotNull (path, "couldn't find SwiftCore.xml!");
td.Read (path);
var operators = td.OperatorsForModule ("Swift");
- Assert.AreNotEqual (0, operators.Count (), "no operators?!");
+ ClassicAssert.AreNotEqual (0, operators.Count (), "no operators?!");
var opWithName = operators.Where (op => op.Name == opName);
- Assert.IsTrue (opWithName.Any (), $"no operators named {opName}");
+ ClassicAssert.IsTrue (opWithName.Any (), $"no operators named {opName}");
var opWithType = opWithName.Where (op => op.OperatorType == opType);
- Assert.IsTrue (opWithType.Any (), $"no operator named {opName} with type {opType}");
+ ClassicAssert.IsTrue (opWithType.Any (), $"no operator named {opName} with type {opType}");
if (precedenceGroup != null) {
- Assert.IsNotNull (opWithType.FirstOrDefault (op => op.PrecedenceGroup == precedenceGroup), $"precendence mismatch on {opName} of {opType} with {precedenceGroup}");
+ ClassicAssert.IsNotNull (opWithType.FirstOrDefault (op => op.PrecedenceGroup == precedenceGroup), $"precendence mismatch on {opName} of {opType} with {precedenceGroup}");
}
}
diff --git a/tests/tom-swifty-test/SwiftReflector/UnicodeMappingTests.cs b/tests/tom-swifty-test/SwiftReflector/UnicodeMappingTests.cs
index 114f91ac..0ef8672f 100644
--- a/tests/tom-swifty-test/SwiftReflector/UnicodeMappingTests.cs
+++ b/tests/tom-swifty-test/SwiftReflector/UnicodeMappingTests.cs
@@ -5,6 +5,7 @@
using Dynamo;
using Dynamo.CSLang;
using NUnit.Framework;
+using NUnit.Framework.Legacy;
using tomwiftytest;
namespace SwiftReflector
@@ -26,7 +27,7 @@ public void EmptyMappingsAreIgnored ()
{
var mapper = new UnicodeMapper ();
mapper.AddMappingsFromXML (TemplateWith (""));
- Assert.AreEqual ("U03A3", mapper.MapToUnicodeName ("Σ"));
+ ClassicAssert.AreEqual ("U03A3", mapper.MapToUnicodeName ("Σ"));
}
[Test]
@@ -34,19 +35,19 @@ public void MappingsWithMissingPartsAreIgnored ()
{
var mapper = new UnicodeMapper ();
mapper.AddMappingsFromXML (TemplateWith ($@""));
- Assert.AreEqual ("U03A3", mapper.MapToUnicodeName ("Σ"));
+ ClassicAssert.AreEqual ("U03A3", mapper.MapToUnicodeName ("Σ"));
}
[Test]
public void BuiltinMapping ()
{
- Assert.AreEqual ("Alpha", UnicodeMapper.Default.MapToUnicodeName ("α"));
+ ClassicAssert.AreEqual ("Alpha", UnicodeMapper.Default.MapToUnicodeName ("α"));
}
[Test]
public void WithNoMapping ()
{
- Assert.AreEqual ("U03B6", UnicodeMapper.Default.MapToUnicodeName ("ζ"));
+ ClassicAssert.AreEqual ("U03B6", UnicodeMapper.Default.MapToUnicodeName ("ζ"));
}
[Test]
@@ -54,7 +55,7 @@ public void XMLMapping ()
{
var mapper = new UnicodeMapper ();
mapper.AddMappingsFromXML (TemplateWith ($@""));
- Assert.AreEqual ("Sigma", mapper.MapToUnicodeName ("Σ"));
+ ClassicAssert.AreEqual ("Sigma", mapper.MapToUnicodeName ("Σ"));
}
[Test]
@@ -62,7 +63,7 @@ public void XMLMultiPartsMapping ()
{
var mapper = new UnicodeMapper ();
mapper.AddMappingsFromXML (TemplateWith ($@""));
- Assert.AreEqual ("Apple", mapper.MapToUnicodeName ("🍎"));
+ ClassicAssert.AreEqual ("Apple", mapper.MapToUnicodeName ("🍎"));
}
[Test]
@@ -71,7 +72,7 @@ public void XMLRemapping ()
var mapper = new UnicodeMapper ();
mapper.AddMappingsFromXML (TemplateWith ($@""));
mapper.AddMappingsFromXML (TemplateWith ($@""));
- Assert.AreEqual ("Sigma", mapper.MapToUnicodeName ("Σ"));
+ ClassicAssert.AreEqual ("Sigma", mapper.MapToUnicodeName ("Σ"));
}
}
diff --git a/tests/tom-swifty-test/SwiftRuntimeLibraryTests/SwiftArrayTests.cs b/tests/tom-swifty-test/SwiftRuntimeLibraryTests/SwiftArrayTests.cs
index c66a1545..53b812da 100644
--- a/tests/tom-swifty-test/SwiftRuntimeLibraryTests/SwiftArrayTests.cs
+++ b/tests/tom-swifty-test/SwiftRuntimeLibraryTests/SwiftArrayTests.cs
@@ -27,39 +27,39 @@ public void DefaultConstructor ()
{
using (var arr = new SwiftArray ()) {
arr.Add (1);
- Assert.AreEqual (1, arr.Count, "Count");
+ Assert.That (arr.Count, Is.EqualTo (1), "Count");
}
}
[Test]
public void Constructor_Capacity ()
{
- using (var arr = new SwiftArray ((nint) 20)) {
- Assert.AreEqual (0, arr.Count, "Count 1");
- Assert.GreaterOrEqual (arr.Capacity, 20, "Capacity 1");
+ using (var arr = new SwiftArray ((nint)20)) {
+ Assert.That (arr.Count, Is.EqualTo (1), "Count 1");
+ Assert.That (arr.Capacity, Is.GreaterThanOrEqualTo (20), "Capacity 1");
arr.Add (10);
- Assert.AreEqual (1, arr.Count, "Count 2");
- Assert.GreaterOrEqual (arr.Capacity, 20, "Capacity 2");
+ Assert.That (arr.Count, Is.EqualTo (2), "Count 2");
+ Assert.That (arr.Capacity, Is.GreaterThanOrEqualTo (20), "Capacity 2");
}
- Assert.Throws (() => new SwiftArray ((long)-1));
+ Assert.Throws (() => new SwiftArray (-1));
}
[Test]
public void Constructor_Params ()
{
using (var arr = new SwiftArray (true, false, true)) {
- Assert.AreEqual (3, arr.Count, "Count 1");
- Assert.IsTrue (arr [0], "1");
- Assert.IsFalse (arr [1], "2");
- Assert.IsTrue (arr [2], "3");
+ Assert.That (arr.Count, Is.EqualTo (3), "Count 1");
+ Assert.That (arr [0], Is.EqualTo (true), "1");
+ Assert.That (arr [1], Is.EqualTo (false), "2");
+ Assert.That (arr [2], Is.EqualTo (true), "3");
}
Assert.Throws (() => new SwiftArray ((sbyte [])null), "Null");
- using (var arr = new SwiftArray ((SwiftString) "Hello", (SwiftString) string.Empty)) {
- Assert.AreEqual (2, arr.Count, "Count 1");
- Assert.AreEqual ("Hello", arr [0].ToString (), "1");
- Assert.AreEqual (string.Empty, arr [1].ToString (), "2");
+ using (var arr = new SwiftArray ((SwiftString)"Hello", (SwiftString)string.Empty)) {
+ Assert.That (arr.Count, Is.EqualTo (2), "Count 1");
+ Assert.That (arr [0].ToString (), Is.EqualTo ("Hello"), "1");
+ Assert.That (arr [1].ToString (), Is.EqualTo (string.Empty), "2");
}
}
@@ -68,10 +68,10 @@ public void Constructor_IList ()
{
var list = (IList)new short [] { 1, 2, 3 };
using (var arr = new SwiftArray (list)) {
- Assert.AreEqual (3, arr.Count, "Count 1");
- Assert.AreEqual (1, arr [0], "1");
- Assert.AreEqual (2, arr [1], "2");
- Assert.AreEqual (3, arr [2], "3");
+ Assert.That (arr.Count, Is.EqualTo (3), "Count 1");
+ Assert.That (arr [0], Is.EqualTo (1), "1");
+ Assert.That (arr [1], Is.EqualTo (2), "2");
+ Assert.That (arr [2], Is.EqualTo (3), "3");
}
Assert.Throws (() => new SwiftArray ((IList)null), "ANE");
}
@@ -81,10 +81,10 @@ public void Constructor_IEnumerable ()
{
var enumerable = (IEnumerable)new ushort [] { 1, 2, 3 };
using (var arr = new SwiftArray (enumerable)) {
- Assert.AreEqual (3, arr.Count, "Count 1");
- Assert.AreEqual (1, arr [0], "1");
- Assert.AreEqual (2, arr [1], "2");
- Assert.AreEqual (3, arr [2], "3");
+ Assert.That (arr.Count, Is.EqualTo (3), "Count 1");
+ Assert.That (arr [0], Is.EqualTo (1), "1");
+ Assert.That (arr [1], Is.EqualTo (2), "2");
+ Assert.That (arr [2], Is.EqualTo (3), "3");
}
Assert.Throws (() => new SwiftArray ((IEnumerable)null), "ANE");
}
@@ -93,10 +93,10 @@ public void Constructor_IEnumerable ()
public void Indexers ()
{
using (var arr = new SwiftArray (1, 2, 3)) {
- Assert.AreEqual (3, arr.Count, "Count 1");
- Assert.AreEqual (1, arr [0], "1");
- Assert.AreEqual (2, arr [1], "2");
- Assert.AreEqual (3, arr [2], "3");
+ Assert.That (arr.Count, Is.EqualTo (3), "Count 1");
+ Assert.That (arr [0], Is.EqualTo (1), "1");
+ Assert.That (arr [1], Is.EqualTo (2), "2");
+ Assert.That (arr [2], Is.EqualTo (3), "3");
Assert.Throws (() => GC.KeepAlive (arr [3]), "IOORE 3");
Assert.Throws (() => GC.KeepAlive (arr [-1]), "IOORE -1");
arr [0] = 10;
@@ -115,7 +115,7 @@ public void Indexers ()
public void Count ()
{
using (var arr = new SwiftArray (1, 2, 3, 4, 5, 6, 7, 8, 9)) {
- Assert.AreEqual (9, arr.Count, "Count 1");
+ Assert.That (arr.Count, Is.EqualTo (9), "Count 1");
arr.Dispose ();
Assert.Throws (() => { var x = arr.Count; }, "Count ODE");
@@ -125,9 +125,9 @@ public void Count ()
[Test]
public void Capacity ()
{
- using (var arr = new SwiftArray ((nint) 10)) {
- Assert.AreEqual (0, arr.Count, "Count 1");
- Assert.GreaterOrEqual (arr.Capacity, 10, "Capacity 1");
+ using (var arr = new SwiftArray ((nint)10)) {
+ Assert.That (arr.Count, Is.EqualTo (0), "Count 1");
+ Assert.That (arr.Capacity, Is.GreaterThanOrEqualTo (10), "Capacity 1");
arr.Dispose ();
Assert.Throws (() => { var x = arr.Capacity; }, "Capacity ODE");
@@ -141,7 +141,7 @@ public void IEnumerable ()
var list = new List ();
foreach (var item in arr)
list.Add (item);
- CollectionAssert.AreEqual (new sbyte [] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, list, "Enumerator");
+ Assert.That (arr, Is.EquivalentTo (list));
arr.Dispose ();
var enumerator = arr.GetEnumerator (); // No exception
@@ -155,11 +155,11 @@ public void IEnumerable ()
public void Add ()
{
using (var arr = new SwiftArray ()) {
- Assert.AreEqual (0, arr.Count, "Count 1");
+ Assert.That (arr.Count, Is.EqualTo (0), "Count 1");
arr.Add (20);
- Assert.GreaterOrEqual (arr.Capacity, 1, "Capacity 1");
- Assert.AreEqual (1, arr.Count, "Count 2");
- Assert.AreEqual (20, arr [0], "Item 1");
+ Assert.That (arr.Capacity, Is.GreaterThanOrEqualTo (1), "Capacity 1");
+ Assert.That (arr.Count, Is.EqualTo (1), "Count 2");
+ Assert.That (arr [0], Is.EqualTo (20), "Item 1");
arr.Dispose ();
Assert.Throws (() => arr.Add (3), "Add ODE");
@@ -172,11 +172,11 @@ public void AddRange_IList ()
var collection = (IList)new int [] { 4, 5, 6 };
using (var arr = new SwiftArray ()) {
arr.AddRange (collection);
- Assert.GreaterOrEqual (arr.Capacity, 3, "Capacity 1");
- Assert.AreEqual (3, arr.Count, "Count 2");
- Assert.AreEqual (4, arr [0], "Item 1");
- Assert.AreEqual (5, arr [1], "Item 2");
- Assert.AreEqual (6, arr [2], "Item 3");
+ Assert.That (arr.Capacity, Is.GreaterThanOrEqualTo (3), "Capacity 1");
+ Assert.That (arr.Count, Is.EqualTo (3), "Count 2");
+ Assert.That (arr [0], Is.EqualTo (4), "Item 1");
+ Assert.That (arr [1], Is.EqualTo (5), "Item 2");
+ Assert.That (arr [2], Is.EqualTo (6), "Item 3");
Assert.Throws (() => arr.AddRange ((IList)null), "ANE");
@@ -191,11 +191,11 @@ public void AddRange_IEnumerable ()
var collection = (IEnumerable)new int [] { 4, 5, 6 };
using (var arr = new SwiftArray ()) {
arr.AddRange (collection);
- Assert.GreaterOrEqual (arr.Capacity, 3, "Capacity 1");
- Assert.AreEqual (3, arr.Count, "Count 2");
- Assert.AreEqual (4, arr [0], "Item 1");
- Assert.AreEqual (5, arr [1], "Item 2");
- Assert.AreEqual (6, arr [2], "Item 3");
+ Assert.That (arr.Capacity, Is.GreaterThanOrEqualTo (3), "Capacity 1");
+ Assert.That (arr.Count, Is.EqualTo (3), "Count 2");
+ Assert.That (arr [0], Is.EqualTo (4), "Item 1");
+ Assert.That (arr [1], Is.EqualTo (5), "Item 2");
+ Assert.That (arr [2], Is.EqualTo (6), "Item 3");
Assert.Throws (() => arr.AddRange ((IEnumerable)null), "ANE");
@@ -209,11 +209,11 @@ public void Clear ()
{
using (var arr = new SwiftArray (1, 2, 3, 4, 5, 6, 7, 8, 9)) {
arr.Clear ();
- Assert.AreEqual (0, arr.Count, "Count 1");
+ Assert.That (arr.Count, Is.EqualTo (0), "Count 1");
arr.Add (1);
- Assert.AreEqual (1, arr.Count, "Count 2");
+ Assert.That (arr.Count, Is.EqualTo (1), "Count 2");
arr.Clear ();
- Assert.AreEqual (0, arr.Count, "Count 3");
+ Assert.That (arr.Count, Is.EqualTo (0), "Count 3");
arr.Dispose ();
Assert.Throws (() => arr.Clear (), "Clear ODE");
@@ -224,14 +224,14 @@ public void Clear ()
public void Contains ()
{
using (var arr = new SwiftArray (1, 2, 3, 4, 5, 6, 7, 8, 9)) {
- Assert.IsTrue (arr.Contains (8), "Contains 1");
- Assert.IsFalse (arr.Contains (10), "Contains 2");
+ Assert.That (arr.Contains (8), "Contains 1");
+ Assert.That (!arr.Contains (10), "Contains 2");
arr.Clear ();
- Assert.IsFalse (arr.Contains (8), "Contains 3");
- Assert.IsFalse (arr.Contains (10), "Contains 4");
+ Assert.That (!arr.Contains (8), "Contains 3");
+ Assert.That (!arr.Contains (10), "Contains 4");
arr.Add (10);
- Assert.IsFalse (arr.Contains (8), "Contains 5");
- Assert.IsTrue (arr.Contains (10), "Contains 6");
+ Assert.That (!arr.Contains (8), "Contains 5");
+ Assert.That (arr.Contains (10), "Contains 6");
arr.Dispose ();
Assert.Throws (() => arr.Contains (3), "Contains ODE");
@@ -244,11 +244,11 @@ public void CopyTo ()
using (var arr = new SwiftArray (1, 2, 3, 4, 5, 6, 7, 8, 9)) {
var copy = new double [10];
arr.CopyTo (copy, 1);
- CollectionAssert.AreEqual (new double [] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, copy, "CopyTo 1");
+ Assert.That (copy, Is.EquivalentTo (new double [] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }), "CopyTo 1");
copy = new double [9];
Assert.Throws (() => arr.CopyTo (copy, 1), "CopyTo 2");
- CollectionAssert.AreEqual (new double [9], copy, "CopyTo 1");
+ Assert.That (copy, Is.EquivalentTo (new double [9]), "CopyTo 1");
Assert.Throws (() => arr.CopyTo (copy, -1), "CopyTo 3");
Assert.Throws (() => arr.CopyTo (copy, int.MaxValue), "CopyTo 4");
@@ -263,15 +263,15 @@ public void CopyTo ()
public void Remove ()
{
using (var arr = new SwiftArray (1, 2, 3, 4, 5, 6, 7, 8, 9)) {
- Assert.IsTrue (arr.Contains (8), "Contains 1");
- Assert.IsFalse (arr.Contains (10), "Contains 2");
- Assert.IsTrue (arr.Remove (8), "Remove 1");
- Assert.AreEqual (8, arr.Count, "Count 1");
- Assert.IsFalse (arr.Contains (8), "Contains 3");
- Assert.IsFalse (arr.Contains (10), "Contains 4");
+ Assert.That (arr.Contains (8), "Contains 1");
+ Assert.That (!arr.Contains (10), "Contains 2");
+ Assert.That (arr.Remove (8), "Remove 1");
+ Assert.That (arr.Count, Is.EqualTo (8), "Count 1");
+ Assert.That (!arr.Contains (8), "Contains 3");
+ Assert.That (!arr.Contains (10), "Contains 4");
- Assert.IsFalse (arr.Remove (8), "Remove 2");
- Assert.AreEqual (8, arr.Count, "Count 2");
+ Assert.That (!arr.Remove (8), "Remove 2");
+ Assert.That (arr.Count, Is.EqualTo (8), "Count 2");
arr.Dispose ();
Assert.Throws (() => arr.Remove (1), "Remove ODE");
@@ -282,8 +282,8 @@ public void Remove ()
public void IndexOf ()
{
using (var arr = new SwiftArray (9, 8, 7, 6, 5, 4, 3, 2, 1)) {
- Assert.AreEqual (2, arr.IndexOf (7), "IndexOf 1");
- Assert.AreEqual (-1, arr.IndexOf (10), "IndexOf 2");
+ Assert.That (arr.IndexOf (7), Is.EqualTo (2), "IndexOf 1");
+ Assert.That (arr.IndexOf (10), Is.EqualTo (-1), "IndexOf 2");
arr.Dispose ();
Assert.Throws (() => arr.IndexOf (5), "IndexOf 4");
@@ -295,9 +295,9 @@ public void Insert ()
{
using (var arr = new SwiftArray (9, 8, 7, 6, 5, 4, 3, 2, 1)) {
arr.Insert (4, 20);
- Assert.AreEqual (10, arr.Count, "Count 1");
- CollectionAssert.AreEqual (new ulong [] { 9, 8, 7, 6, 20, 5, 4, 3, 2, 1 }, arr, "Items 1");
- Assert.AreEqual (20, arr [4], "Item 4");
+ Assert.That (arr.Count, Is.EqualTo (10), "Count 1");
+ Assert.That (arr, Is.EquivalentTo (new ulong [] { 9, 8, 7, 6, 20, 5, 4, 3, 2, 1 }), "Items 1");
+ Assert.That (arr [4], Is.EqualTo (20), "Item 4");
Assert.Throws (() => arr.Insert (-1, 100), "Insert Ex 1");
Assert.Throws (() => arr.Insert (11, 100), "Insert Ex 2");
@@ -311,15 +311,15 @@ public void Insert ()
public void RemoveAt ()
{
using (var arr = new SwiftArray (9, 8, 7, 6, 5, 4, 3, 2, 1)) {
- Assert.IsTrue (arr.Contains (8), "Contains 1");
- Assert.IsFalse (arr.Contains (10), "Contains 2");
+ Assert.That (arr.Contains (8), "Contains 1");
+ Assert.That (!arr.Contains (10), "Contains 2");
arr.RemoveAt (1);
- Assert.AreEqual (8, arr.Count, "Count 1");
- Assert.IsFalse (arr.Contains (8), "Contains 3");
- Assert.IsFalse (arr.Contains (10), "Contains 4");
+ Assert.That (arr.Count, Is.EqualTo (8), "Count 1");
+ Assert.That (!arr.Contains (8), "Contains 3");
+ Assert.That (!arr.Contains (10), "Contains 4");
- Assert.IsFalse (arr.Remove (8), "Remove 2");
- Assert.AreEqual (8, arr.Count, "Count 2");
+ Assert.That (!arr.Remove (8), "Remove 2");
+ Assert.That (arr.Count, Is.EqualTo (8), "Count 2");
Assert.Throws (() => arr.RemoveAt (-1), "RemoveAt Ex 1");
Assert.Throws (() => arr.RemoveAt (20), "RemoveAt Ex 2");
@@ -334,10 +334,10 @@ public void RemoveAt ()
public void ReadOnly ()
{
using (var arr = new SwiftArray (9, 8, 7, 6, 5, 4, 3, 2, 1)) {
- Assert.IsFalse (arr.IsReadOnly, "IsReadOnly 1");
+ Assert.That (!arr.IsReadOnly, "IsReadOnly 1");
arr.Dispose ();
- Assert.IsFalse (arr.IsReadOnly, "IsReadOnly 2"); // No ObjectDisposedException
+ Assert.That (!arr.IsReadOnly, "IsReadOnly 2"); // No ObjectDisposedException
}
}
}
diff --git a/tests/tom-swifty-test/SwiftRuntimeLibraryTests/SwiftObjectRegistryTests.cs b/tests/tom-swifty-test/SwiftRuntimeLibraryTests/SwiftObjectRegistryTests.cs
index 8d23abea..180090c8 100644
--- a/tests/tom-swifty-test/SwiftRuntimeLibraryTests/SwiftObjectRegistryTests.cs
+++ b/tests/tom-swifty-test/SwiftRuntimeLibraryTests/SwiftObjectRegistryTests.cs
@@ -10,6 +10,7 @@
using System.Collections.Generic;
using SwiftRuntimeLibrary;
using SwiftRuntimeLibrary.SwiftMarshal;
+using NUnit.Framework.Legacy;
namespace SwiftRuntimeLibraryTests {
[TestFixture]
@@ -24,7 +25,7 @@ public class SwiftObjectRegistryTests {
// AnonymousSwiftObject anon = AnonymousSwiftObject.XamarinFactory (sham);
//
// AnonymousSwiftObject registered = SwiftObjectRegistry.Registry.CSObjectForSwiftObject (sham);
- // Assert.AreEqual (anon, registered);
+ // ClassicAssert.AreEqual (anon, registered);
// }
class GoodISwiftObject : ISwiftObject {
@@ -104,14 +105,14 @@ public void BadClassFailRegister ()
{
// has no class factory
IntPtr sham = new IntPtr (42);
- Assert.Throws (() => {
+ ClassicAssert.Throws (() => {
try {
- Assert.IsFalse (SwiftObjectRegistry.Registry.Contains (sham));
+ ClassicAssert.IsFalse (SwiftObjectRegistry.Registry.Contains (sham));
using (SwiftObjectRegistry.Registry.CSObjectForSwiftObject (sham)) {
}
} finally {
- Assert.IsFalse (SwiftObjectRegistry.Registry.Contains (sham));
+ ClassicAssert.IsFalse (SwiftObjectRegistry.Registry.Contains (sham));
}
});
}
diff --git a/tests/tom-swifty-test/TestRunning.cs b/tests/tom-swifty-test/TestRunning.cs
index a5bc470d..8f4d5ed3 100644
--- a/tests/tom-swifty-test/TestRunning.cs
+++ b/tests/tom-swifty-test/TestRunning.cs
@@ -13,6 +13,8 @@
using SwiftReflector.IOUtils;
using Xamarin.Utils;
using System.Text.RegularExpressions;
+using NUnit.Framework.Legacy;
+using Microsoft.VisualStudio.TestPlatform.ObjectModel;
[assembly: Parallelizable]
@@ -96,9 +98,6 @@ static void AddMacSpecificInitializationCode (CSClass cl)
var dlopen = CSMethod.PrivatePInvoke (CSSimpleType.IntPtr, "dlopen", "/usr/lib/libSystem.dylib", "dlopen", parms);
cl.Methods.Add (dlopen);
- var appID = new CSIdentifier ("Application");
- cl.Fields.Add (CSFieldDeclaration.FieldLine (new CSSimpleType (typeof (Type)), appID, null, CSVisibility.None, true));
-
// NSApplication.Init ();
var body = CSCodeBlock.Create (CSFunctionCall.FunctionCallLine ("AppKit.NSApplication.Init", false));
@@ -224,7 +223,7 @@ static CodeElementCollection CaptureSwiftOutputPostlude (string fi
CSLine pathLine = CSVariableDeclaration.VarLine (CSSimpleType.String, pathID,
new CSFunctionCall ("Path.Combine", false,
- new CSArray1D (urlID.Name, CSConstant.Val (0)).Dot (new CSIdentifier ("Path")),
+ new CSArray1D (urlID.Name, CSConstant.Val (0)).Dot (new CSIdentifier ("Path!")),
CSConstant.Val (fileName)));
block.Add (pathLine);
block.Add (new CSIdentifier ("\n#endif\n"));
@@ -257,7 +256,7 @@ static void SetInvokingTestNameIfUnset (ref string callingMethodName, out string
if (string.IsNullOrEmpty (callingMethodName)) {
if (!callingMethod.CustomAttributes.Any (x => x.AttributeType.Name == "TestAttribute"))
- Assert.Fail ("TestRunning expect invocations without an explicit `testName` parameter to be invoked from the [Test] method directly. Consider passing an explicit `testName`.");
+ ClassicAssert.Fail ("TestRunning expect invocations without an explicit `testName` parameter to be invoked from the [Test] method directly. Consider passing an explicit `testName`.");
callingMethodName = callingMethod.Name;
}
@@ -292,7 +291,7 @@ public static void TestAndExecuteNoDevice (string swiftCode, CodeElementCollecti
CopyTestReferencesTo (tempDirectoryPath, platform);
var output = Execute (tempDirectoryPath, "NameNotImportant.exe", platform);
- Assert.AreEqual (expectedOutput, output);
+ ClassicAssert.AreEqual (expectedOutput, output);
}
}
@@ -411,10 +410,10 @@ public static void TestAndExecute (string swiftCode, CodeElementCollection () {
- { "PKG_CONFIG_LIBDIR", null }
- };
- var rv = ExecAndCollect.RunCommand ("/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/bin/mmp", "--link_flags=-headerpad_max_install_names " + StringUtils.Quote ($"@{responseFile}"),
- env: env, output: output, verbose: true);
- if (rv != 0) {
- Console.WriteLine (output);
- throw new Exception ($"Failed to run mmp, exit code: {rv}");
- }
-
- // This should probably go into mmp/mtouch
- // run swift-stdlib-tool to get swift libraries into the app.
- var appPath = Path.Combine (workingDirectory, name, name + ".app");
+ var name = Path.GetFileNameWithoutExtension (executable);
+ var appPath = Path.Combine (workingDirectory, name, $"bin/Debug/net{Compiler.kframeWorkVersion}-macos/osx-x64/{name}.app");
var appExecutable = Path.Combine (appPath, "Contents", "MacOS", name);
- var swift_stdlib_tool = new StringBuilder ();
- swift_stdlib_tool.Append ($"swift-stdlib-tool ");
- swift_stdlib_tool.Append ($"--copy ");
- swift_stdlib_tool.Append ($"--verbose ");
- swift_stdlib_tool.Append ($"--scan-executable {StringUtils.Quote (appExecutable)} ");
- swift_stdlib_tool.Append ($"--platform macosx ");
- swift_stdlib_tool.Append ($"--destination {StringUtils.Quote (Path.Combine (appPath, "Contents", "Frameworks"))} ");
- swift_stdlib_tool.Append ($"--strip-bitcode ");
- swift_stdlib_tool.Append ($"--scan-folder {StringUtils.Quote (Path.Combine (appPath, "Contents", "MonoBundle"))} ");
- swift_stdlib_tool.Append ($"--scan-folder {StringUtils.Quote (Path.Combine (appPath, "Contents", "Frameworks"))} ");
- swift_stdlib_tool.Append ($"--platform macosx ");
- swift_stdlib_tool.Append ($"--source-libraries {StringUtils.Quote (Compiler.SystemCompilerLocation.SwiftCompilerLib)} ");
- output.Clear ();
- rv = ExecAndCollect.RunCommand ("xcrun", swift_stdlib_tool.ToString (), output: output, verbose: true);
- if (rv != 0) {
- Console.WriteLine (output);
- throw new Exception ($"Failed to run swift-stdlib-tool, exit code: {rv}\n{output}\n");
- }
-
- // This should probably go into mmp/mtouch
- // make sure the executable has the Frameworks and MonoBundle directories as rpaths.
var install_name_tool = new StringBuilder ();
install_name_tool.Append ($"install_name_tool ");
install_name_tool.Append ($"-add_rpath @executable_path/../Frameworks ");
@@ -754,7 +697,7 @@ public static string Execute (string workingDirectory, string executable, Platfo
install_name_tool.Append ($"-change XamGlue @rpath/XamGlue ");
install_name_tool.Append ($"{StringUtils.Quote (Path.Combine (appPath, "Contents", "MacOS", name))} ");
output.Clear ();
- rv = ExecAndCollect.RunCommand ("xcrun", install_name_tool.ToString (), output: output, verbose: true);
+ var rv = ExecAndCollect.RunCommand ("xcrun", install_name_tool.ToString (), output: output, verbose: true);
if (rv != 0) {
Console.WriteLine (output);
throw new Exception ($"Failed to run install_name_tool, exit code: {rv}\n{output}\n");
@@ -762,8 +705,13 @@ public static string Execute (string workingDirectory, string executable, Platfo
var exec_output = new StringBuilder ();
var exec_env = new Dictionary ();
- //exec_env.Add ("MONO_LOG_LEVEL", "debug");
- //exec_env.Add ("MONO_LOG_MASK", "dll");
+
+ // probably need links to runtime libraries and swift glue
+ exec_env.Add ("DYLD_LIBRARY_PATH", Compiler.AddOrAppendPathTo (exec_env, "DYLD_LIBRARY_PATH", Compiler.kSystemLib));
+ Compiler.RunCommandWithLeaks ("otool", new StringBuilder ($"-L {appExecutable} "), exec_env, exec_output);
+ Console.WriteLine (exec_output);
+ exec_output = new StringBuilder ();
+
var exec_rv = Compiler.RunCommandWithLeaks (appExecutable, new StringBuilder (), exec_env, exec_output);
if (exec_rv != 0) {
Console.WriteLine (exec_output);
@@ -772,10 +720,10 @@ public static string Execute (string workingDirectory, string executable, Platfo
return exec_output.ToString ();
}
case PlatformName.iOS:
- Assert.Ignore ($"Execution does not apply during a test run for {platform}, tests will be executed as part of the device tests.");
+ ClassicAssert.Ignore ($"Execution does not apply during a test run for {platform}, tests will be executed as part of the device tests.");
return string.Empty;
case PlatformName.None: {
- return Compiler.RunWithMono (executable, workingDirectory, platform: platform);
+ return Compiler.RunWithDotnet (executable, workingDirectory, platform: platform);
}
default:
throw new NotImplementedException (platform.ToString ());
@@ -783,10 +731,13 @@ public static string Execute (string workingDirectory, string executable, Platfo
}
static string [] testMacRuntimeAssemblies = {
- Path.Combine (ConstructorTests.kXamarinMacDir, "Xamarin.Mac.dll"),
+
};
static string [] testiOSRuntimeAssemblies = {
- Path.Combine (ConstructorTests.kXamariniOSDir, "Xamarin.iOS.dll"),
+
+ };
+ static string [] testnoneRuntimeAssemblies = {
+ Path.Combine (ConstructorTests.kSwiftRuntimeOutputDirectory, $"{ConstructorTests.kSwiftRuntimeLibrary}.dll"),
};
public static void CopyTestReferencesTo (string targetDirectory, PlatformName platform = PlatformName.None)
@@ -801,7 +752,8 @@ public static void CopyTestReferencesTo (string targetDirectory, PlatformName pl
references = testiOSRuntimeAssemblies;
break;
case PlatformName.None:
- return;
+ references = testnoneRuntimeAssemblies;
+ break;
default:
throw new NotImplementedException (platform.ToString ());
}
@@ -828,8 +780,10 @@ public static void FailOnBadWarnings (string warnings)
// that generate them. Removing them all is not a small task at this
// point.
capturedMatches.Remove ("warning CS0219:");
+ // CS8632 is a nullable warning in the main. NBD.
+ capturedMatches.Remove ("warning CS8632:");
if (capturedMatches.Count > 0)
- Assert.Fail ($"Unexpected C# compiler warning(s): {warnings}");
+ ClassicAssert.Fail ($"Unexpected C# compiler warning(s): {warnings}");
}
static void SnarfSwiftInterfaceFile (string childPath, string testName, string testClassName, string nameSpace, string targetDirectory)
diff --git a/tests/tom-swifty-test/XmlReflectionTests/ComparatorTests.cs b/tests/tom-swifty-test/XmlReflectionTests/ComparatorTests.cs
index e4fe2048..f5a41422 100644
--- a/tests/tom-swifty-test/XmlReflectionTests/ComparatorTests.cs
+++ b/tests/tom-swifty-test/XmlReflectionTests/ComparatorTests.cs
@@ -5,6 +5,7 @@
using System.Xml.Linq;
using NUnit;
using NUnit.Framework;
+using NUnit.Framework.Legacy;
namespace XmlReflectionTests {
[TestFixture]
@@ -20,7 +21,7 @@ void Compare (string testName, int expectedDiffs, string firstXml, string second
var sb = new StringBuilder ();
diffs.ForEach (s => sb.Append (s).Append ('\n'));
- Assert.AreEqual (expectedDiffs, diffs.Count, $"Mismatch from test {testName} diffs:\n{sb.ToString ()}");
+ ClassicAssert.AreEqual (expectedDiffs, diffs.Count, $"Mismatch from test {testName} diffs:\n{sb.ToString ()}");
}
[Test]
diff --git a/tests/tom-swifty-test/XmlReflectionTests/DynamicXmlTests.cs b/tests/tom-swifty-test/XmlReflectionTests/DynamicXmlTests.cs
index 9bd25406..4aa0f06b 100644
--- a/tests/tom-swifty-test/XmlReflectionTests/DynamicXmlTests.cs
+++ b/tests/tom-swifty-test/XmlReflectionTests/DynamicXmlTests.cs
@@ -15,6 +15,7 @@
using SwiftReflector.SwiftInterfaceReflector;
using SwiftReflector.TypeMapping;
using DylibBinder;
+using NUnit.Framework.Legacy;
namespace XmlReflectionTests {
[TestFixture]
@@ -94,17 +95,17 @@ void TestFuncReturning (string declaredType, string value, string expectedType,
{
string code = String.Format ("public func foo() -> {0} {{ return {1} }}", declaredType, value);
ModuleDeclaration module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
- Assert.AreEqual (1, module.Functions.Count (), "wrong func count");
+ ClassicAssert.IsNotNull (module, "no module");
+ ClassicAssert.AreEqual (1, module.Functions.Count (), "wrong func count");
FunctionDeclaration func = module.Functions.First ();
- Assert.IsNotNull (func, "no func");
- Assert.AreEqual (func.Name, "foo", "bad name");
- Assert.AreEqual (expectedType, func.ReturnTypeName, "wrong return type");
- Assert.AreEqual (1, func.ParameterLists.Count, "wrong parameter list count");
- Assert.AreEqual (0, func.ParameterLists [0].Count, "wrong parameter count");
+ ClassicAssert.IsNotNull (func, "no func");
+ ClassicAssert.AreEqual (func.Name, "foo", "bad name");
+ ClassicAssert.AreEqual (expectedType, func.ReturnTypeName, "wrong return type");
+ ClassicAssert.AreEqual (1, func.ParameterLists.Count, "wrong parameter list count");
+ ClassicAssert.AreEqual (0, func.ParameterLists [0].Count, "wrong parameter count");
NamedTypeSpec ns = func.ReturnTypeSpec as NamedTypeSpec;
- Assert.NotNull (ns, "not a named type spec");
- Assert.AreEqual (expectedType, ns.Name, "wrong name");
+ ClassicAssert.NotNull (ns, "not a named type spec");
+ ClassicAssert.AreEqual (expectedType, ns.Name, "wrong name");
}
@@ -155,10 +156,10 @@ public void TestFuncReturningString (ReflectorMode mode)
public void TestEmptyClass (ReflectorMode mode)
{
ModuleDeclaration module = ReflectToModules ("public class Foo { } ", "SomeModule").Find (m => m.Name == "SomeModule");
- Assert.AreEqual (1, module.Classes.Count (), "wrong classes count");
- Assert.AreEqual (0, module.Functions.Count (), "wrong function count");
- Assert.AreEqual (0, module.Structs.Count (), "wrong structs count");
- Assert.AreEqual ("Foo", module.Classes.First ().Name, "wrong name");
+ ClassicAssert.AreEqual (1, module.Classes.Count (), "wrong classes count");
+ ClassicAssert.AreEqual (0, module.Functions.Count (), "wrong function count");
+ ClassicAssert.AreEqual (0, module.Structs.Count (), "wrong structs count");
+ ClassicAssert.AreEqual ("Foo", module.Classes.First ().Name, "wrong name");
}
[TestCase (ReflectorMode.Parser)]
@@ -166,10 +167,10 @@ public void TestEmptyClass (ReflectorMode mode)
public void TestEmptyStruct (ReflectorMode mode)
{
ModuleDeclaration module = ReflectToModules ("public struct Foo { } ", "SomeModule").Find (m => m.Name == "SomeModule");
- Assert.AreEqual (0, module.Classes.Count (), "wrong classes count");
- Assert.AreEqual (0, module.Functions.Count (), "wrong function count");
- Assert.AreEqual (1, module.Structs.Count (), "wrong structs count");
- Assert.AreEqual ("Foo", module.Structs.First ().Name, "wrong name");
+ ClassicAssert.AreEqual (0, module.Classes.Count (), "wrong classes count");
+ ClassicAssert.AreEqual (0, module.Functions.Count (), "wrong function count");
+ ClassicAssert.AreEqual (1, module.Structs.Count (), "wrong structs count");
+ ClassicAssert.AreEqual ("Foo", module.Structs.First ().Name, "wrong name");
}
[TestCase (ReflectorMode.Parser)]
@@ -178,17 +179,17 @@ public void TestStructLayout (ReflectorMode mode)
{
ModuleDeclaration module = ReflectToModules ("public struct Foo { public var X:Int;\n public var Y:Bool; public var Z: Float; }", "SomeModule", mode)
.Find (m => m.Name == "SomeModule");
- Assert.NotNull (module, "no module");
+ ClassicAssert.NotNull (module, "no module");
StructDeclaration theStruct = module.Structs.FirstOrDefault (s => s.Name == "Foo");
- Assert.NotNull (theStruct, "no struct");
+ ClassicAssert.NotNull (theStruct, "no struct");
List props = theStruct.Members.OfType ().ToList ();
- Assert.AreEqual (3, props.Count, "wrong props count");
- Assert.AreEqual ("X", props [0].Name, "not x");
- Assert.AreEqual ("Y", props [1].Name, "not y");
- Assert.AreEqual ("Z", props [2].Name, "not z");
- Assert.AreEqual ("Swift.Int", props [0].TypeName, "not int");
- Assert.AreEqual ("Swift.Bool", props [1].TypeName, "not bool");
- Assert.AreEqual ("Swift.Float", props [2].TypeName, "not float");
+ ClassicAssert.AreEqual (3, props.Count, "wrong props count");
+ ClassicAssert.AreEqual ("X", props [0].Name, "not x");
+ ClassicAssert.AreEqual ("Y", props [1].Name, "not y");
+ ClassicAssert.AreEqual ("Z", props [2].Name, "not z");
+ ClassicAssert.AreEqual ("Swift.Int", props [0].TypeName, "not int");
+ ClassicAssert.AreEqual ("Swift.Bool", props [1].TypeName, "not bool");
+ ClassicAssert.AreEqual ("Swift.Float", props [2].TypeName, "not float");
}
[TestCase (ReflectorMode.Parser)]
@@ -197,15 +198,15 @@ public void TestClassWithConstructor (ReflectorMode mode)
{
ModuleDeclaration module = ReflectToModules ("public class Foo { public var x:Int; public init(y:Int) { x = y; } }", "SomeModule", mode)
.Find (m => m.Name == "SomeModule");
- Assert.NotNull (module, "not module");
+ ClassicAssert.NotNull (module, "not module");
ClassDeclaration theClass = module.Classes.FirstOrDefault (c => c.Name == "Foo");
- Assert.NotNull (theClass, "not class");
+ ClassicAssert.NotNull (theClass, "not class");
FunctionDeclaration cons = theClass.Members.OfType ().FirstOrDefault (s => s.Name == ".ctor");
- Assert.NotNull (cons, "no constructor");
- Assert.AreEqual (2, cons.ParameterLists.Count, "wrong parameterlist count");
- Assert.AreEqual (1, cons.ParameterLists [1].Count, "wrong arg count");
- Assert.AreEqual ("Swift.Int", cons.ParameterLists [1] [0].TypeName, "wrong type");
- Assert.AreEqual ("y", cons.ParameterLists [1] [0].PublicName, "wrong name");
+ ClassicAssert.NotNull (cons, "no constructor");
+ ClassicAssert.AreEqual (2, cons.ParameterLists.Count, "wrong parameterlist count");
+ ClassicAssert.AreEqual (1, cons.ParameterLists [1].Count, "wrong arg count");
+ ClassicAssert.AreEqual ("Swift.Int", cons.ParameterLists [1] [0].TypeName, "wrong type");
+ ClassicAssert.AreEqual ("y", cons.ParameterLists [1] [0].PublicName, "wrong name");
}
[TestCase (ReflectorMode.Parser)]
@@ -214,11 +215,11 @@ public void TestClassHasDestructor (ReflectorMode mode)
{
ModuleDeclaration module = ReflectToModules ("public class Foo { public var x:Int; public init(y:Int) { x = y; } }", "SomeModule", mode)
.Find (m => m.Name == "SomeModule");
- Assert.NotNull (module, "not module");
+ ClassicAssert.NotNull (module, "not module");
ClassDeclaration theClass = module.Classes.FirstOrDefault (c => c.Name == "Foo");
- Assert.NotNull (theClass, "not a class");
+ ClassicAssert.NotNull (theClass, "not a class");
FunctionDeclaration dtor = theClass.Members.OfType ().FirstOrDefault (s => s.Name == ".dtor");
- Assert.NotNull (dtor, "not a destructor");
+ ClassicAssert.NotNull (dtor, "not a destructor");
}
[TestCase (ReflectorMode.Parser)]
@@ -227,10 +228,10 @@ public void FuncReturningTuple (ReflectorMode mode)
{
ModuleDeclaration module = ReflectToModules ("public func returnTuple()->(Int,Float) { return (0, 3.0); }", "SomeModule", mode)
.Find (m => m.Name == "SomeModule");
- Assert.NotNull (module, "not module");
+ ClassicAssert.NotNull (module, "not module");
FunctionDeclaration func = module.Functions.FirstOrDefault (f => f.Name == "returnTuple");
var result = func.ReturnTypeName.Replace (" ", "");
- Assert.AreEqual ("(Swift.Int,Swift.Float)", result, "wrong type");
+ ClassicAssert.AreEqual ("(Swift.Int,Swift.Float)", result, "wrong type");
}
[TestCase (ReflectorMode.Parser)]
@@ -239,10 +240,10 @@ public void FuncReturningDictionary (ReflectorMode mode)
{
ModuleDeclaration module = ReflectToModules ("public func returnDict()->[Int:Float] { return [Int:Float](); }", "SomeModule", mode)
.Find (m => m.Name == "SomeModule");
- Assert.NotNull (module, "not module");
+ ClassicAssert.NotNull (module, "not module");
FunctionDeclaration func = module.Functions.FirstOrDefault (f => f.Name == "returnDict");
var returnType = func.ReturnTypeName.Replace (" ", "");
- Assert.AreEqual ("Swift.Dictionary", returnType, "wrong type");
+ ClassicAssert.AreEqual ("Swift.Dictionary", returnType, "wrong type");
}
@@ -253,10 +254,10 @@ public void FuncReturningIntThrows (ReflectorMode mode)
ModuleDeclaration module = ReflectToModules ("public enum MathError : Error {\ncase divZero\n}\n" +
"public func returnInt(a:Int) throws ->Int { if a < 1\n{\n throw MathError.divZero\n }\n else {\n return a\n}\n}", "SomeModule", mode)
.Find (m => m.Name == "SomeModule");
- Assert.NotNull (module, "not module");
+ ClassicAssert.NotNull (module, "not module");
FunctionDeclaration func = module.Functions.FirstOrDefault (f => f.Name == "returnInt");
- Assert.AreEqual ("Swift.Int", func.ReturnTypeName, "wrong type");
- Assert.AreEqual (true, func.HasThrows, "doesn't throw");
+ ClassicAssert.AreEqual ("Swift.Int", func.ReturnTypeName, "wrong type");
+ ClassicAssert.AreEqual (true, func.HasThrows, "doesn't throw");
}
@@ -267,9 +268,9 @@ public void FuncReturningIntOption (ReflectorMode mode)
{
ModuleDeclaration module = ReflectToModules ("public func returnIntOpt()->Int? { return 3; }", "SomeModule", mode)
.Find (m => m.Name == "SomeModule");
- Assert.NotNull (module, "not module");
+ ClassicAssert.NotNull (module, "not module");
FunctionDeclaration func = module.Functions.FirstOrDefault (f => f.Name == "returnIntOpt");
- Assert.AreEqual ("Swift.Optional", func.ReturnTypeName, "wrong type");
+ ClassicAssert.AreEqual ("Swift.Optional", func.ReturnTypeName, "wrong type");
}
[TestCase (ReflectorMode.Parser)]
@@ -278,9 +279,9 @@ public void GlobalBool (ReflectorMode mode)
{
ModuleDeclaration module = ReflectToModules ("public var aGlobal:Bool = true", "SomeModule", mode)
.Find (m => m.Name == "SomeModule");
- Assert.NotNull (module, "not module");
+ ClassicAssert.NotNull (module, "not module");
PropertyDeclaration decl = module.TopLevelProperties.FirstOrDefault (f => f.Name == "aGlobal");
- Assert.IsNotNull (decl, "no declaration");
+ ClassicAssert.IsNotNull (decl, "no declaration");
}
[TestCase (ReflectorMode.Parser)]
@@ -289,14 +290,14 @@ public void EnumSmokeTest1 (ReflectorMode mode)
{
string code = "public enum foo { case a, b, c, d }";
ModuleDeclaration module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
- Assert.AreEqual (1, module.AllEnums.Count, "wrong enums count");
+ ClassicAssert.IsNotNull (module, "not a module");
+ ClassicAssert.AreEqual (1, module.AllEnums.Count, "wrong enums count");
EnumDeclaration edecl = module.AllEnums.First ();
- Assert.AreEqual (edecl.Name, "foo", "wrong name");
- Assert.AreEqual (4, edecl.Elements.Count, "wrong element count");
- Assert.IsTrue (edecl.IsTrivial, "wrong triviality");
- Assert.IsTrue (edecl.IsHomogenous, "wrong homogeneity");
- Assert.IsFalse (edecl.HasRawType, "wrong has raw type");
+ ClassicAssert.AreEqual (edecl.Name, "foo", "wrong name");
+ ClassicAssert.AreEqual (4, edecl.Elements.Count, "wrong element count");
+ ClassicAssert.IsTrue (edecl.IsTrivial, "wrong triviality");
+ ClassicAssert.IsTrue (edecl.IsHomogenous, "wrong homogeneity");
+ ClassicAssert.IsFalse (edecl.HasRawType, "wrong has raw type");
}
[TestCase (ReflectorMode.Parser)]
@@ -305,18 +306,18 @@ public void EnumSmokeTest2 (ReflectorMode mode)
{
string code = "public enum foo { case a(Int), b(Int), c(Int), d(Int) }";
ModuleDeclaration module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
- Assert.AreEqual (1, module.AllEnums.Count, "wrong enums count");
+ ClassicAssert.IsNotNull (module, "not a module");
+ ClassicAssert.AreEqual (1, module.AllEnums.Count, "wrong enums count");
EnumDeclaration edecl = module.AllEnums.First ();
- Assert.AreEqual (edecl.Name, "foo", "wrong name");
- Assert.AreEqual (4, edecl.Elements.Count, "wrong element count");
+ ClassicAssert.AreEqual (edecl.Name, "foo", "wrong name");
+ ClassicAssert.AreEqual (4, edecl.Elements.Count, "wrong element count");
foreach (EnumElement elem in edecl.Elements) {
- Assert.IsTrue (elem.HasType, "no type");
+ ClassicAssert.IsTrue (elem.HasType, "no type");
}
- Assert.IsFalse (edecl.IsTrivial, "wrong triviality");
- Assert.IsTrue (edecl.IsIntegral, "wrong integral");
- Assert.IsTrue (edecl.IsHomogenous, "wrong homogeneity");
- Assert.IsFalse (edecl.HasRawType, "wrong has raw type");
+ ClassicAssert.IsFalse (edecl.IsTrivial, "wrong triviality");
+ ClassicAssert.IsTrue (edecl.IsIntegral, "wrong integral");
+ ClassicAssert.IsTrue (edecl.IsHomogenous, "wrong homogeneity");
+ ClassicAssert.IsFalse (edecl.HasRawType, "wrong has raw type");
}
[TestCase (ReflectorMode.Parser)]
@@ -325,18 +326,18 @@ public void EnumSmokeTest3 (ReflectorMode mode)
{
string code = "public enum foo { case a(UInt), b(Int), c(Int), d(Int) }";
ModuleDeclaration module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
- Assert.AreEqual (1, module.AllEnums.Count, "wrong enums count");
+ ClassicAssert.IsNotNull (module, "not a module");
+ ClassicAssert.AreEqual (1, module.AllEnums.Count, "wrong enums count");
EnumDeclaration edecl = module.AllEnums.First ();
- Assert.AreEqual (edecl.Name, "foo", "wrong name");
- Assert.AreEqual (4, edecl.Elements.Count, "wrong element count");
+ ClassicAssert.AreEqual (edecl.Name, "foo", "wrong name");
+ ClassicAssert.AreEqual (4, edecl.Elements.Count, "wrong element count");
foreach (EnumElement elem in edecl.Elements) {
- Assert.IsTrue (elem.HasType, "no type");
+ ClassicAssert.IsTrue (elem.HasType, "no type");
}
- Assert.IsFalse (edecl.IsTrivial, "wrong triviality");
- Assert.IsTrue (edecl.IsIntegral, "wrong integral");
- Assert.IsFalse (edecl.IsHomogenous, "wrong homogeneity");
- Assert.IsFalse (edecl.HasRawType, "wrong has raw type");
+ ClassicAssert.IsFalse (edecl.IsTrivial, "wrong triviality");
+ ClassicAssert.IsTrue (edecl.IsIntegral, "wrong integral");
+ ClassicAssert.IsFalse (edecl.IsHomogenous, "wrong homogeneity");
+ ClassicAssert.IsFalse (edecl.HasRawType, "wrong has raw type");
}
[TestCase (ReflectorMode.Parser)]
@@ -345,15 +346,15 @@ public void EnumSmokeTest4 (ReflectorMode mode)
{
string code = "public enum foo { case a(Int), b, c, d }";
ModuleDeclaration module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
- Assert.AreEqual (1, module.AllEnums.Count, "wrong enums count");
+ ClassicAssert.IsNotNull (module, "not a module");
+ ClassicAssert.AreEqual (1, module.AllEnums.Count, "wrong enums count");
EnumDeclaration edecl = module.AllEnums.First ();
- Assert.AreEqual (edecl.Name, "foo", "wrong name");
- Assert.AreEqual (4, edecl.Elements.Count, "wrong element count");
- Assert.IsFalse (edecl.IsTrivial, "wrong triviality");
- Assert.IsTrue (edecl.IsIntegral, "wrong integral");
- Assert.IsFalse (edecl.IsHomogenous, "wrong homogeneity");
- Assert.IsFalse (edecl.HasRawType, "wrong has raw type");
+ ClassicAssert.AreEqual (edecl.Name, "foo", "wrong name");
+ ClassicAssert.AreEqual (4, edecl.Elements.Count, "wrong element count");
+ ClassicAssert.IsFalse (edecl.IsTrivial, "wrong triviality");
+ ClassicAssert.IsTrue (edecl.IsIntegral, "wrong integral");
+ ClassicAssert.IsFalse (edecl.IsHomogenous, "wrong homogeneity");
+ ClassicAssert.IsFalse (edecl.HasRawType, "wrong has raw type");
}
@@ -365,16 +366,16 @@ public void EnumSmokeTest5 (ReflectorMode mode)
{
string code = "public enum foo:Int { case a=1, b, c, d }";
ModuleDeclaration module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
- Assert.AreEqual (1, module.AllEnums.Count, "wrong enums count");
+ ClassicAssert.IsNotNull (module, "not a module");
+ ClassicAssert.AreEqual (1, module.AllEnums.Count, "wrong enums count");
EnumDeclaration edecl = module.AllEnums.First ();
- Assert.AreEqual (edecl.Name, "foo", "wrong name");
- Assert.AreEqual (4, edecl.Elements.Count, "wrong element count");
- Assert.IsFalse (edecl.IsTrivial, "wrong triviality");
- Assert.IsTrue (edecl.IsIntegral, "wrong integral");
- Assert.IsTrue (edecl.IsHomogenous, "wrong homogeneity");
- Assert.IsTrue (edecl.HasRawType, "wrong has raw type");
- Assert.AreEqual ("Swift.Int", edecl.RawTypeName, "wrong raw type name");
+ ClassicAssert.AreEqual (edecl.Name, "foo", "wrong name");
+ ClassicAssert.AreEqual (4, edecl.Elements.Count, "wrong element count");
+ ClassicAssert.IsFalse (edecl.IsTrivial, "wrong triviality");
+ ClassicAssert.IsTrue (edecl.IsIntegral, "wrong integral");
+ ClassicAssert.IsTrue (edecl.IsHomogenous, "wrong homogeneity");
+ ClassicAssert.IsTrue (edecl.HasRawType, "wrong has raw type");
+ ClassicAssert.AreEqual ("Swift.Int", edecl.RawTypeName, "wrong raw type name");
}
[TestCase (ReflectorMode.Parser)]
@@ -383,16 +384,16 @@ public void EnumSmokeTest6 (ReflectorMode mode)
{
string code = "public enum foo:Int { case a, b, c, d }";
ModuleDeclaration module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
- Assert.AreEqual (1, module.AllEnums.Count, "wrong enums count");
+ ClassicAssert.IsNotNull (module, "not a module");
+ ClassicAssert.AreEqual (1, module.AllEnums.Count, "wrong enums count");
EnumDeclaration edecl = module.AllEnums.First ();
- Assert.AreEqual (edecl.Name, "foo", "wrong name");
- Assert.AreEqual (4, edecl.Elements.Count, "wrong element count");
- Assert.IsFalse (edecl.IsTrivial, "wrong triviality");
- Assert.IsTrue (edecl.IsIntegral, "wrong integral");
- Assert.IsTrue (edecl.IsHomogenous, "wrong homogeneity");
- Assert.IsTrue (edecl.HasRawType, "wrong has raw type");
- Assert.AreEqual ("Swift.Int", edecl.RawTypeName, "wrong raw type name");
+ ClassicAssert.AreEqual (edecl.Name, "foo", "wrong name");
+ ClassicAssert.AreEqual (4, edecl.Elements.Count, "wrong element count");
+ ClassicAssert.IsFalse (edecl.IsTrivial, "wrong triviality");
+ ClassicAssert.IsTrue (edecl.IsIntegral, "wrong integral");
+ ClassicAssert.IsTrue (edecl.IsHomogenous, "wrong homogeneity");
+ ClassicAssert.IsTrue (edecl.HasRawType, "wrong has raw type");
+ ClassicAssert.AreEqual ("Swift.Int", edecl.RawTypeName, "wrong raw type name");
}
[TestCase (ReflectorMode.Parser)]
@@ -401,20 +402,20 @@ public void EnumSmokeTest7 (ReflectorMode mode)
{
string code = "public enum foo { case a(UInt), b(Int), c(Bool), d(Float) }";
ModuleDeclaration module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
- Assert.AreEqual (1, module.AllEnums.Count, "wrong enums count");
+ ClassicAssert.IsNotNull (module, "not a module");
+ ClassicAssert.AreEqual (1, module.AllEnums.Count, "wrong enums count");
EnumDeclaration edecl = module.AllEnums.First ();
- Assert.AreEqual (edecl.Name, "foo", "wrong name");
- Assert.AreEqual (4, edecl.Elements.Count, "wrong element count");
- Assert.IsFalse (edecl.IsTrivial, "wrong triviality");
- Assert.IsFalse (edecl.IsIntegral, "wrong integral");
- Assert.IsFalse (edecl.IsHomogenous, "wrong homogeneity");
- Assert.IsFalse (edecl.HasRawType, "wrong has raw type");
+ ClassicAssert.AreEqual (edecl.Name, "foo", "wrong name");
+ ClassicAssert.AreEqual (4, edecl.Elements.Count, "wrong element count");
+ ClassicAssert.IsFalse (edecl.IsTrivial, "wrong triviality");
+ ClassicAssert.IsFalse (edecl.IsIntegral, "wrong integral");
+ ClassicAssert.IsFalse (edecl.IsHomogenous, "wrong homogeneity");
+ ClassicAssert.IsFalse (edecl.HasRawType, "wrong has raw type");
- Assert.AreEqual ("Swift.UInt", edecl ["a"].TypeName, "wrong raw type name uint");
- Assert.AreEqual ("Swift.Int", edecl ["b"].TypeName, "wrong raw type name int");
- Assert.AreEqual ("Swift.Bool", edecl ["c"].TypeName, "wrong raw type name bool");
- Assert.AreEqual ("Swift.Float", edecl ["d"].TypeName, "wrong raw type name float");
+ ClassicAssert.AreEqual ("Swift.UInt", edecl ["a"].TypeName, "wrong raw type name uint");
+ ClassicAssert.AreEqual ("Swift.Int", edecl ["b"].TypeName, "wrong raw type name int");
+ ClassicAssert.AreEqual ("Swift.Bool", edecl ["c"].TypeName, "wrong raw type name bool");
+ ClassicAssert.AreEqual ("Swift.Float", edecl ["d"].TypeName, "wrong raw type name float");
}
@@ -424,7 +425,7 @@ public void OptionalSmokeTest1 (ReflectorMode mode)
{
string code = "public func optInt(x:Int) -> Int? { if (x >= 0) { return x; }\nreturn nil; }\n";
ModuleDeclaration module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
+ ClassicAssert.IsNotNull (module, "not a module");
}
[TestCase (ReflectorMode.Parser)]
@@ -435,17 +436,17 @@ public void TypeAliasTest (ReflectorMode mode)
"public typealias Bar = Foo\n" +
"public func aliased(a: Bar, b: (Bar)->()) {\n}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
+ ClassicAssert.IsNotNull (module, "not a module");
var func = module.TopLevelFunctions.FirstOrDefault (f => f.Name == "aliased");
- Assert.IsNotNull (func, "no func");
+ ClassicAssert.IsNotNull (func, "no func");
var named = func.ParameterLists [0] [0].TypeSpec as NamedTypeSpec;
- Assert.IsNotNull (named, "not a named type spec");
- Assert.AreEqual ("Swift.OpaquePointer", named.Name, "wrong name");
+ ClassicAssert.IsNotNull (named, "not a named type spec");
+ ClassicAssert.AreEqual ("Swift.OpaquePointer", named.Name, "wrong name");
var closType = func.ParameterLists [0] [1].TypeSpec as ClosureTypeSpec;
- Assert.IsNotNull (closType, "not a closure");
+ ClassicAssert.IsNotNull (closType, "not a closure");
named = closType.Arguments as NamedTypeSpec;
- Assert.IsNotNull (named, "not a named type spec 2");
- Assert.AreEqual ("Swift.OpaquePointer", named.Name, "wrong name 2");
+ ClassicAssert.IsNotNull (named, "not a named type spec 2");
+ ClassicAssert.AreEqual ("Swift.OpaquePointer", named.Name, "wrong name 2");
}
@@ -457,11 +458,11 @@ public void DeprecatedFunction (ReflectorMode mode)
"@available(*, deprecated, message: \"no reason\")" +
"public func foo() { }";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module");
+ ClassicAssert.IsNotNull (module, "module");
var func = module.TopLevelFunctions.FirstOrDefault (f => f.Name == "foo");
- Assert.IsNotNull (func, "func");
- Assert.IsTrue (func.IsDeprecated, "deprecated");
- Assert.IsFalse (func.IsUnavailable, "unavailable");
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.IsTrue (func.IsDeprecated, "deprecated");
+ ClassicAssert.IsFalse (func.IsUnavailable, "unavailable");
}
@@ -473,11 +474,11 @@ public void DeprecatedClass (ReflectorMode mode)
"@available(*, deprecated, message: \"no reason\")" +
"public class Foo { }";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
+ ClassicAssert.IsNotNull (module, "not a module");
var cl = module.Classes.FirstOrDefault (f => f.Name == "Foo");
- Assert.IsNotNull (cl, "no class");
- Assert.IsTrue (cl.IsDeprecated, "not deprecated");
- Assert.IsFalse (cl.IsUnavailable, "available");
+ ClassicAssert.IsNotNull (cl, "no class");
+ ClassicAssert.IsTrue (cl.IsDeprecated, "not deprecated");
+ ClassicAssert.IsFalse (cl.IsUnavailable, "available");
}
[TestCase (ReflectorMode.Parser)]
@@ -488,11 +489,11 @@ public void ObsoletedFunction (ReflectorMode mode)
"@available(swift, obsoleted:3.0, message: \"no reason\")" +
"public func foo() { }";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module");
+ ClassicAssert.IsNotNull (module, "module");
var func = module.TopLevelFunctions.FirstOrDefault (f => f.Name == "foo");
- Assert.IsNotNull (func, "func");
- Assert.IsFalse (func.IsDeprecated, "deprecated");
- Assert.IsTrue (func.IsUnavailable, "unavilable");
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.IsFalse (func.IsDeprecated, "deprecated");
+ ClassicAssert.IsTrue (func.IsUnavailable, "unavilable");
}
@@ -504,11 +505,11 @@ public void ObsoletedClass (ReflectorMode mode)
"@available(swift, obsoleted:3.0, message: \"no reason\")" +
"public class Foo { }";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
+ ClassicAssert.IsNotNull (module, "not a module");
var cl = module.Classes.FirstOrDefault (f => f.Name == "Foo");
- Assert.IsNotNull (cl, "no class");
- Assert.IsFalse (cl.IsDeprecated, "deprecated");
- Assert.IsTrue (cl.IsUnavailable, "unavailable");
+ ClassicAssert.IsNotNull (cl, "no class");
+ ClassicAssert.IsFalse (cl.IsDeprecated, "deprecated");
+ ClassicAssert.IsTrue (cl.IsUnavailable, "unavailable");
}
@@ -520,11 +521,11 @@ public void UnavailableFunction (ReflectorMode mode)
"@available(*, unavailable)" +
"public func foo() { }";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
+ ClassicAssert.IsNotNull (module, "not a module");
var func = module.TopLevelFunctions.FirstOrDefault (f => f.Name == "foo");
- Assert.IsNotNull (func, "no func");
- Assert.IsFalse (func.IsDeprecated, "deprecated");
- Assert.IsTrue (func.IsUnavailable, "unavailable");
+ ClassicAssert.IsNotNull (func, "no func");
+ ClassicAssert.IsFalse (func.IsDeprecated, "deprecated");
+ ClassicAssert.IsTrue (func.IsUnavailable, "unavailable");
}
@@ -536,11 +537,11 @@ public void UnavailableClass (ReflectorMode mode)
"@available(*, unavailable)" +
"public class Foo { }";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
+ ClassicAssert.IsNotNull (module, "not a module");
var cl = module.Classes.FirstOrDefault (f => f.Name == "Foo");
- Assert.IsNotNull (cl, "class");
- Assert.IsFalse (cl.IsDeprecated, "deprecated");
- Assert.IsTrue (cl.IsUnavailable, "unavailable");
+ ClassicAssert.IsNotNull (cl, "class");
+ ClassicAssert.IsFalse (cl.IsDeprecated, "deprecated");
+ ClassicAssert.IsTrue (cl.IsUnavailable, "unavailable");
}
@@ -557,14 +558,14 @@ public void MethodInStruct (ReflectorMode mode)
" }\n" +
"}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
+ ClassicAssert.IsNotNull (module, "not a module");
var st = module.Structs.FirstOrDefault (f => f.Name == "CommandEvaluation");
- Assert.IsNotNull (st, "no struct");
- Assert.IsFalse (st.IsDeprecated, "deprecated");
- Assert.IsFalse (st.IsUnavailable, "unavailable");
+ ClassicAssert.IsNotNull (st, "no struct");
+ ClassicAssert.IsFalse (st.IsDeprecated, "deprecated");
+ ClassicAssert.IsFalse (st.IsUnavailable, "unavailable");
var func = st.AllMethodsNoCDTor ().Where (fn => fn.Name == "retrieveParameter").FirstOrDefault ();
- Assert.IsNotNull (func, "no func");
- Assert.IsTrue (func.IsDeprecated, "deprecated");
+ ClassicAssert.IsNotNull (func, "no func");
+ ClassicAssert.IsTrue (func.IsDeprecated, "deprecated");
}
[TestCase (ReflectorMode.Parser)]
@@ -577,11 +578,11 @@ public void UnavailableProperty (ReflectorMode mode)
" public static var nullJSON: Int { return 3 }\n" +
"}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
+ ClassicAssert.IsNotNull (module, "not a module");
var st = module.Structs.FirstOrDefault (f => f.Name == "JSON");
var prop = st.AllProperties ().Where (fn => fn.Name == "nullJSON").FirstOrDefault ();
- Assert.IsNotNull (prop, "no prop");
- Assert.IsTrue (prop.IsUnavailable, "unavailable");
+ ClassicAssert.IsNotNull (prop, "no prop");
+ ClassicAssert.IsTrue (prop.IsUnavailable, "unavailable");
}
@@ -594,11 +595,11 @@ public void ExtensionProperty (ReflectorMode mode)
" public var millisecond: Double { return self / 1000 }\n" +
"}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
- Assert.AreEqual (1, module.Extensions.Count, "Expected an extension");
+ ClassicAssert.IsNotNull (module, "not a module");
+ ClassicAssert.AreEqual (1, module.Extensions.Count, "Expected an extension");
var ext = module.Extensions [0];
- Assert.AreEqual ("Swift.Double", ext.ExtensionOnTypeName, $"Incorrect type name {ext.ExtensionOnTypeName}");
- Assert.AreEqual (2, ext.Members.Count, $"Expected 2 members but got {ext.Members.Count}");
+ ClassicAssert.AreEqual ("Swift.Double", ext.ExtensionOnTypeName, $"Incorrect type name {ext.ExtensionOnTypeName}");
+ ClassicAssert.AreEqual (2, ext.Members.Count, $"Expected 2 members but got {ext.Members.Count}");
}
[TestCase (ReflectorMode.Parser)]
@@ -610,13 +611,13 @@ public void ExtensionFunc (ReflectorMode mode)
" public func DoubleIt() -> Double { return self * 2; }\n" +
"}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
- Assert.AreEqual (1, module.Extensions.Count, "Expected an extension");
+ ClassicAssert.IsNotNull (module, "not a module");
+ ClassicAssert.AreEqual (1, module.Extensions.Count, "Expected an extension");
var ext = module.Extensions [0];
- Assert.AreEqual ("Swift.Double", ext.ExtensionOnTypeName, $"Incorrect type name {ext.ExtensionOnTypeName}");
- Assert.AreEqual (1, ext.Members.Count, $"Expected 1 member but got {ext.Members.Count}");
+ ClassicAssert.AreEqual ("Swift.Double", ext.ExtensionOnTypeName, $"Incorrect type name {ext.ExtensionOnTypeName}");
+ ClassicAssert.AreEqual (1, ext.Members.Count, $"Expected 1 member but got {ext.Members.Count}");
var func = ext.Members [0] as FunctionDeclaration;
- Assert.IsNotNull (func, $"Expected a FunctionDeclaration but got {ext.Members [0].GetType ().Name}");
+ ClassicAssert.IsNotNull (func, $"Expected a FunctionDeclaration but got {ext.Members [0].GetType ().Name}");
}
[TestCase (ReflectorMode.Parser)]
@@ -631,17 +632,17 @@ public void ExtensionProto (ReflectorMode mode)
" public func printIt() { print(self) }\n" +
"}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
- Assert.AreEqual (1, module.Extensions.Count, "Expected an extension");
+ ClassicAssert.IsNotNull (module, "not a module");
+ ClassicAssert.AreEqual (1, module.Extensions.Count, "Expected an extension");
var ext = module.Extensions [0];
- Assert.AreEqual ("Swift.Double", ext.ExtensionOnTypeName, $"Incorrect type name {ext.ExtensionOnTypeName}");
- Assert.AreEqual (1, ext.Members.Count, $"Expected 1 member but got {ext.Members.Count}");
+ ClassicAssert.AreEqual ("Swift.Double", ext.ExtensionOnTypeName, $"Incorrect type name {ext.ExtensionOnTypeName}");
+ ClassicAssert.AreEqual (1, ext.Members.Count, $"Expected 1 member but got {ext.Members.Count}");
var func = ext.Members [0] as FunctionDeclaration;
- Assert.IsNotNull (func, $"Expected a FunctionDeclaration but got {ext.Members [0].GetType ().Name}");
- Assert.AreEqual (1, ext.Inheritance.Count, $"Expected 1 inheritance but had {ext.Inheritance.Count}");
+ ClassicAssert.IsNotNull (func, $"Expected a FunctionDeclaration but got {ext.Members [0].GetType ().Name}");
+ ClassicAssert.AreEqual (1, ext.Inheritance.Count, $"Expected 1 inheritance but had {ext.Inheritance.Count}");
var inh = ext.Inheritance [0];
- Assert.AreEqual ("SomeModule.Printer", inh.InheritedTypeName, $"Incorrect type name {inh.InheritedTypeName}");
- Assert.AreEqual (InheritanceKind.Protocol, inh.InheritanceKind, $"Should always be protocol inheritance");
+ ClassicAssert.AreEqual ("SomeModule.Printer", inh.InheritedTypeName, $"Incorrect type name {inh.InheritedTypeName}");
+ ClassicAssert.AreEqual (InheritanceKind.Protocol, inh.InheritanceKind, $"Should always be protocol inheritance");
}
[TestCase (ReflectorMode.Parser)]
@@ -657,18 +658,18 @@ public void ObjCOptionalMember (ReflectorMode mode)
"}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
- Assert.AreEqual (1, module.Protocols.Count (), "Expected a protocol.");
+ ClassicAssert.IsNotNull (module, "module is null");
+ ClassicAssert.AreEqual (1, module.Protocols.Count (), "Expected a protocol.");
var proto = module.Protocols.First ();
- Assert.IsTrue (proto.IsObjC, "not objc protocol");
- Assert.AreEqual ("SomeModule.Proto", proto.ToFullyQualifiedName (true), "Misnamed protocol");
- Assert.AreEqual (2, proto.Members.Count (), "incorrect number of members");
+ ClassicAssert.IsTrue (proto.IsObjC, "not objc protocol");
+ ClassicAssert.AreEqual ("SomeModule.Proto", proto.ToFullyQualifiedName (true), "Misnamed protocol");
+ ClassicAssert.AreEqual (2, proto.Members.Count (), "incorrect number of members");
var fooFunc = proto.Members.OfType ().Where (f => f.Name == "foo").FirstOrDefault ();
- Assert.IsNotNull (fooFunc, "No func named foo");
- Assert.IsTrue (fooFunc.IsOptional, "should be optional");
+ ClassicAssert.IsNotNull (fooFunc, "No func named foo");
+ ClassicAssert.IsTrue (fooFunc.IsOptional, "should be optional");
var barFunc = proto.Members.OfType ().Where (f => f.Name == "bar").FirstOrDefault ();
- Assert.IsNotNull (barFunc, "No func named bar");
- Assert.IsFalse (barFunc.IsOptional, "should not be optional");
+ ClassicAssert.IsNotNull (barFunc, "No func named bar");
+ ClassicAssert.IsFalse (barFunc.IsOptional, "should not be optional");
}
[TestCase (ReflectorMode.Parser)]
@@ -683,21 +684,21 @@ public void ObjCOptionalProp (ReflectorMode mode)
"}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
- Assert.AreEqual (1, module.Protocols.Count (), "Expected a protocol.");
+ ClassicAssert.IsNotNull (module, "module is null");
+ ClassicAssert.AreEqual (1, module.Protocols.Count (), "Expected a protocol.");
var proto = module.Protocols.First ();
- Assert.IsTrue (proto.IsObjC, "not objc protocol");
- Assert.AreEqual ("SomeModule.Proto1", proto.ToFullyQualifiedName (true), "Misnamed protocol");
- Assert.AreEqual (3, proto.Members.Count (), "incorrect number of members");
+ ClassicAssert.IsTrue (proto.IsObjC, "not objc protocol");
+ ClassicAssert.AreEqual ("SomeModule.Proto1", proto.ToFullyQualifiedName (true), "Misnamed protocol");
+ ClassicAssert.AreEqual (3, proto.Members.Count (), "incorrect number of members");
var xProp = proto.Members.OfType ().Where (f => f.Name == "X").FirstOrDefault ();
- Assert.IsNotNull (xProp, "No prop named X");
- Assert.IsTrue (xProp.IsOptional, "prop is not optional");
+ ClassicAssert.IsNotNull (xProp, "No prop named X");
+ ClassicAssert.IsTrue (xProp.IsOptional, "prop is not optional");
var getter = xProp.GetGetter ();
- Assert.IsNotNull (getter, "Null getter");
- Assert.IsTrue (getter.IsOptional, "getter is not optional");
+ ClassicAssert.IsNotNull (getter, "Null getter");
+ ClassicAssert.IsTrue (getter.IsOptional, "getter is not optional");
var setter = xProp.GetSetter ();
- Assert.IsNotNull (setter, "Null setter");
- Assert.IsTrue (setter.IsOptional, "setter is not optional");
+ ClassicAssert.IsNotNull (setter, "Null setter");
+ ClassicAssert.IsTrue (setter.IsOptional, "setter is not optional");
}
@@ -713,19 +714,19 @@ public void ObjCOptionalSubsript (ReflectorMode mode)
"}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
- Assert.AreEqual (1, module.Protocols.Count (), "Expected a protocol.");
+ ClassicAssert.IsNotNull (module, "module is null");
+ ClassicAssert.AreEqual (1, module.Protocols.Count (), "Expected a protocol.");
var proto = module.Protocols.First ();
- Assert.IsTrue (proto.IsObjC, "not objc protocol");
- Assert.AreEqual ("SomeModule.Proto1", proto.ToFullyQualifiedName (true), "Misnamed protocol");
- Assert.AreEqual (2, proto.Members.Count (), "incorrect number of members");
+ ClassicAssert.IsTrue (proto.IsObjC, "not objc protocol");
+ ClassicAssert.AreEqual ("SomeModule.Proto1", proto.ToFullyQualifiedName (true), "Misnamed protocol");
+ ClassicAssert.AreEqual (2, proto.Members.Count (), "incorrect number of members");
var func0 = proto.Members [0] as FunctionDeclaration;
- Assert.IsNotNull (func0, "expected a function declaration at index 0");
- Assert.IsTrue (func0.IsOptional, "func 0 should be optional");
+ ClassicAssert.IsNotNull (func0, "expected a function declaration at index 0");
+ ClassicAssert.IsTrue (func0.IsOptional, "func 0 should be optional");
var func1 = proto.Members [1] as FunctionDeclaration;
- Assert.IsNotNull (func1, "expected a function declaration at index 1");
- Assert.IsTrue (func1.IsOptional, "func 1 should be optional");
+ ClassicAssert.IsNotNull (func1, "expected a function declaration at index 1");
+ ClassicAssert.IsTrue (func1.IsOptional, "func 1 should be optional");
}
[TestCase ("open", Accessibility.Open, ReflectorMode.Parser)]
@@ -743,11 +744,11 @@ public void PropertyVisibilityCore (string swiftVisibility, Accessibility access
}}";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
- Assert.AreEqual (1, module.AllClasses.Count (), "Expected a class.");
+ ClassicAssert.IsNotNull (module, "module is null");
+ ClassicAssert.AreEqual (1, module.AllClasses.Count (), "Expected a class.");
var fooClass = module.AllClasses.First ();
- Assert.AreEqual (1, fooClass.AllProperties ().Count (), "Expected one property.");
- Assert.AreEqual (accessibility, fooClass.AllProperties () [0].GetSetter ().Access, "Unexpected Visibility.");
+ ClassicAssert.AreEqual (1, fooClass.AllProperties ().Count (), "Expected one property.");
+ ClassicAssert.AreEqual (accessibility, fooClass.AllProperties () [0].GetSetter ().Access, "Unexpected Visibility.");
}
[TestCase (ReflectorMode.Parser)]
@@ -763,18 +764,18 @@ public void ObjCMemberSelector (ReflectorMode mode)
"}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
- Assert.AreEqual (1, module.Protocols.Count (), "Expected a protocol.");
+ ClassicAssert.IsNotNull (module, "module is null");
+ ClassicAssert.AreEqual (1, module.Protocols.Count (), "Expected a protocol.");
var proto = module.Protocols.First ();
- Assert.IsTrue (proto.IsObjC, "not objc protocol");
- Assert.AreEqual ("SomeModule.Proto", proto.ToFullyQualifiedName (true), "Misnamed protocol");
- Assert.AreEqual (2, proto.Members.Count (), "incorrect number of members");
+ ClassicAssert.IsTrue (proto.IsObjC, "not objc protocol");
+ ClassicAssert.AreEqual ("SomeModule.Proto", proto.ToFullyQualifiedName (true), "Misnamed protocol");
+ ClassicAssert.AreEqual (2, proto.Members.Count (), "incorrect number of members");
var fooFunc = proto.Members.OfType ().Where (f => f.Name == "foo").FirstOrDefault ();
- Assert.IsNotNull (fooFunc, "No func named foo");
- Assert.AreEqual ("foo", fooFunc.ObjCSelector, $"Incorrect foo selector name {fooFunc.ObjCSelector}");
+ ClassicAssert.IsNotNull (fooFunc, "No func named foo");
+ ClassicAssert.AreEqual ("foo", fooFunc.ObjCSelector, $"Incorrect foo selector name {fooFunc.ObjCSelector}");
var barFunc = proto.Members.OfType ().Where (f => f.Name == "bar").FirstOrDefault ();
- Assert.IsNotNull (barFunc, "No func named bar");
- Assert.AreEqual ("barWithA:", barFunc.ObjCSelector, $"Incorrect bar selector name {barFunc.ObjCSelector}");
+ ClassicAssert.IsNotNull (barFunc, "No func named bar");
+ ClassicAssert.AreEqual ("barWithA:", barFunc.ObjCSelector, $"Incorrect bar selector name {barFunc.ObjCSelector}");
}
@@ -790,20 +791,20 @@ public void ObjCPropSelector (ReflectorMode mode)
"}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
- Assert.AreEqual (1, module.Protocols.Count (), "Expected a protocol.");
+ ClassicAssert.IsNotNull (module, "module is null");
+ ClassicAssert.AreEqual (1, module.Protocols.Count (), "Expected a protocol.");
var proto = module.Protocols.First ();
- Assert.IsTrue (proto.IsObjC, "not objc protocol");
- Assert.AreEqual ("SomeModule.Proto", proto.ToFullyQualifiedName (true), "Misnamed protocol");
- Assert.AreEqual (3, proto.Members.Count (), "incorrect number of members");
+ ClassicAssert.IsTrue (proto.IsObjC, "not objc protocol");
+ ClassicAssert.AreEqual ("SomeModule.Proto", proto.ToFullyQualifiedName (true), "Misnamed protocol");
+ ClassicAssert.AreEqual (3, proto.Members.Count (), "incorrect number of members");
var xProp = proto.Members.OfType ().Where (f => f.Name == "X").FirstOrDefault ();
- Assert.IsNotNull (xProp, "No prop named X");
+ ClassicAssert.IsNotNull (xProp, "No prop named X");
var getter = xProp.GetGetter ();
- Assert.IsNotNull (getter, "Null getter");
- Assert.AreEqual ("X", getter.ObjCSelector, $"incorrect get X selector name {getter.ObjCSelector}");
+ ClassicAssert.IsNotNull (getter, "Null getter");
+ ClassicAssert.AreEqual ("X", getter.ObjCSelector, $"incorrect get X selector name {getter.ObjCSelector}");
var setter = xProp.GetSetter ();
- Assert.IsNotNull (setter, "Null setter");
- Assert.AreEqual ("setX:", setter.ObjCSelector, $"incorrect set X selector name {setter.ObjCSelector}");
+ ClassicAssert.IsNotNull (setter, "Null setter");
+ ClassicAssert.AreEqual ("setX:", setter.ObjCSelector, $"incorrect set X selector name {setter.ObjCSelector}");
}
[TestCase (ReflectorMode.Parser)]
@@ -818,20 +819,20 @@ public void ObjCPropSelectorLower (ReflectorMode mode)
"}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
- Assert.AreEqual (1, module.Protocols.Count (), "Expected a protocol.");
+ ClassicAssert.IsNotNull (module, "module is null");
+ ClassicAssert.AreEqual (1, module.Protocols.Count (), "Expected a protocol.");
var proto = module.Protocols.First ();
- Assert.IsTrue (proto.IsObjC, "not objc protocol");
- Assert.AreEqual ("SomeModule.Proto", proto.ToFullyQualifiedName (true), "Misnamed protocol");
- Assert.AreEqual (3, proto.Members.Count (), "incorrect number of members");
+ ClassicAssert.IsTrue (proto.IsObjC, "not objc protocol");
+ ClassicAssert.AreEqual ("SomeModule.Proto", proto.ToFullyQualifiedName (true), "Misnamed protocol");
+ ClassicAssert.AreEqual (3, proto.Members.Count (), "incorrect number of members");
var xProp = proto.Members.OfType ().Where (f => f.Name == "x").FirstOrDefault ();
- Assert.IsNotNull (xProp, "No prop named x");
+ ClassicAssert.IsNotNull (xProp, "No prop named x");
var getter = xProp.GetGetter ();
- Assert.IsNotNull (getter, "Null getter");
- Assert.AreEqual ("x", getter.ObjCSelector, $"incorrect get X selector name {getter.ObjCSelector}");
+ ClassicAssert.IsNotNull (getter, "Null getter");
+ ClassicAssert.AreEqual ("x", getter.ObjCSelector, $"incorrect get X selector name {getter.ObjCSelector}");
var setter = xProp.GetSetter ();
- Assert.IsNotNull (setter, "Null setter");
- Assert.AreEqual ("setX:", setter.ObjCSelector, $"incorrect set X selector name {setter.ObjCSelector}");
+ ClassicAssert.IsNotNull (setter, "Null setter");
+ ClassicAssert.AreEqual ("setX:", setter.ObjCSelector, $"incorrect set X selector name {setter.ObjCSelector}");
}
[TestCase (ReflectorMode.Parser)]
@@ -846,19 +847,19 @@ public void ObjCSubsriptSelector (ReflectorMode mode)
"}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
- Assert.AreEqual (1, module.Protocols.Count (), "Expected a protocol.");
+ ClassicAssert.IsNotNull (module, "module is null");
+ ClassicAssert.AreEqual (1, module.Protocols.Count (), "Expected a protocol.");
var proto = module.Protocols.First ();
- Assert.IsTrue (proto.IsObjC, "not objc protocol");
- Assert.AreEqual ("SomeModule.Proto1", proto.ToFullyQualifiedName (true), "Misnamed protocol");
- Assert.AreEqual (2, proto.Members.Count (), "incorrect number of members");
+ ClassicAssert.IsTrue (proto.IsObjC, "not objc protocol");
+ ClassicAssert.AreEqual ("SomeModule.Proto1", proto.ToFullyQualifiedName (true), "Misnamed protocol");
+ ClassicAssert.AreEqual (2, proto.Members.Count (), "incorrect number of members");
var func0 = proto.Members [0] as FunctionDeclaration;
- Assert.IsNotNull (func0, "expected a function declaration at index 0");
- Assert.AreEqual ("objectAtIndexedSubscript:", func0.ObjCSelector, $"Incorrect selector for getter {func0.ObjCSelector}");
+ ClassicAssert.IsNotNull (func0, "expected a function declaration at index 0");
+ ClassicAssert.AreEqual ("objectAtIndexedSubscript:", func0.ObjCSelector, $"Incorrect selector for getter {func0.ObjCSelector}");
var func1 = proto.Members [1] as FunctionDeclaration;
- Assert.IsNotNull (func1, "expected a function declaration at index 1");
- Assert.AreEqual ("setObject:atIndexedSubscript:", func1.ObjCSelector, $"Incorrect selector for setter {func1.ObjCSelector}");
+ ClassicAssert.IsNotNull (func1, "expected a function declaration at index 1");
+ ClassicAssert.AreEqual ("setObject:atIndexedSubscript:", func1.ObjCSelector, $"Incorrect selector for setter {func1.ObjCSelector}");
}
[TestCase (ReflectorMode.Parser)]
@@ -876,20 +877,20 @@ public void RequiredInitTest (ReflectorMode mode)
"}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
- Assert.AreEqual (2, module.Classes.Count (), "Expected 2 classes");
+ ClassicAssert.IsNotNull (module, "module is null");
+ ClassicAssert.AreEqual (2, module.Classes.Count (), "Expected 2 classes");
var baseClass = module.Classes.FirstOrDefault (cl => cl.Name == "BaseWithReq");
- Assert.IsNotNull (baseClass, "didn't find base class");
+ ClassicAssert.IsNotNull (baseClass, "didn't find base class");
var subClass = module.Classes.FirstOrDefault (cl => cl.Name == "SubOfBase");
- Assert.IsNotNull (subClass, "didn't find sub class");
+ ClassicAssert.IsNotNull (subClass, "didn't find sub class");
var baseInit = baseClass.AllConstructors ().FirstOrDefault ();
- Assert.IsNotNull (baseInit, "no constructors in base class");
- Assert.IsTrue (baseInit.IsRequired, "incorrect IsRequired on base class");
+ ClassicAssert.IsNotNull (baseInit, "no constructors in base class");
+ ClassicAssert.IsTrue (baseInit.IsRequired, "incorrect IsRequired on base class");
var subInit = subClass.AllConstructors ().FirstOrDefault ();
- Assert.IsNotNull (subInit, "no constructors in sub class");
- Assert.IsTrue (subInit.IsRequired, "incorrect IsRequired on sub class");
+ ClassicAssert.IsNotNull (subInit, "no constructors in sub class");
+ ClassicAssert.IsTrue (subInit.IsRequired, "incorrect IsRequired on sub class");
}
[TestCase (ReflectorMode.Parser)]
@@ -906,20 +907,20 @@ public void NotRequiredInitTest (ReflectorMode mode)
"open class SubOfBase : BaseWithoutReq {\n" +
"}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
- Assert.AreEqual (2, module.Classes.Count (), "Expected 2 classes");
+ ClassicAssert.IsNotNull (module, "module is null");
+ ClassicAssert.AreEqual (2, module.Classes.Count (), "Expected 2 classes");
var baseClass = module.Classes.FirstOrDefault (cl => cl.Name == "BaseWithoutReq");
- Assert.IsNotNull (baseClass, "didn't find base class");
+ ClassicAssert.IsNotNull (baseClass, "didn't find base class");
var subClass = module.Classes.FirstOrDefault (cl => cl.Name == "SubOfBase");
- Assert.IsNotNull (subClass, "didn't find sub class");
+ ClassicAssert.IsNotNull (subClass, "didn't find sub class");
var baseInit = baseClass.AllConstructors ().FirstOrDefault ();
- Assert.IsNotNull (baseInit, "no constructors in base class");
- Assert.IsFalse (baseInit.IsRequired, "incorrect IsRequired on base class");
+ ClassicAssert.IsNotNull (baseInit, "no constructors in base class");
+ ClassicAssert.IsFalse (baseInit.IsRequired, "incorrect IsRequired on base class");
var subInit = subClass.AllConstructors ().FirstOrDefault ();
- Assert.IsNotNull (subInit, "no constructors in sub class");
- Assert.IsFalse (subInit.IsRequired, "incorrect IsRequired on sub class");
+ ClassicAssert.IsNotNull (subInit, "no constructors in sub class");
+ ClassicAssert.IsFalse (subInit.IsRequired, "incorrect IsRequired on sub class");
}
@@ -929,14 +930,14 @@ public void TestPublicPrivateParamNames (ReflectorMode mode)
{
string code = "public func foo(seen notseen:Int) { }\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.FirstOrDefault (f => f.Name == "foo");
- Assert.IsNotNull (func, "no function");
- Assert.AreEqual (1, func.ParameterLists.Count, "wrong number of parameter lists");
- Assert.AreEqual (1, func.ParameterLists [0].Count, "wrong number of parameters");
- Assert.AreEqual ("seen", func.ParameterLists [0] [0].PublicName, "wrong public name");
- Assert.AreEqual ("notseen", func.ParameterLists [0] [0].PrivateName, "wrong private name");
- Assert.IsTrue (func.ParameterLists [0] [0].NameIsRequired, "Wrong name requirement");
+ ClassicAssert.IsNotNull (func, "no function");
+ ClassicAssert.AreEqual (1, func.ParameterLists.Count, "wrong number of parameter lists");
+ ClassicAssert.AreEqual (1, func.ParameterLists [0].Count, "wrong number of parameters");
+ ClassicAssert.AreEqual ("seen", func.ParameterLists [0] [0].PublicName, "wrong public name");
+ ClassicAssert.AreEqual ("notseen", func.ParameterLists [0] [0].PrivateName, "wrong private name");
+ ClassicAssert.IsTrue (func.ParameterLists [0] [0].NameIsRequired, "Wrong name requirement");
}
[TestCase (ReflectorMode.Parser)]
@@ -945,14 +946,14 @@ public void TestOnlyPublicParamNames (ReflectorMode mode)
{
string code = "public func foo(seen:Int) { }\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.FirstOrDefault (f => f.Name == "foo");
- Assert.IsNotNull (func, "no function");
- Assert.AreEqual (1, func.ParameterLists.Count, "wrong number of parameter lists");
- Assert.AreEqual (1, func.ParameterLists [0].Count, "wrong number of parameters");
- Assert.AreEqual ("seen", func.ParameterLists [0] [0].PublicName, "wrong public name");
- Assert.AreEqual ("seen", func.ParameterLists [0] [0].PrivateName, "wrong private name");
- Assert.IsTrue (func.ParameterLists [0] [0].NameIsRequired, "Wrong name requirement");
+ ClassicAssert.IsNotNull (func, "no function");
+ ClassicAssert.AreEqual (1, func.ParameterLists.Count, "wrong number of parameter lists");
+ ClassicAssert.AreEqual (1, func.ParameterLists [0].Count, "wrong number of parameters");
+ ClassicAssert.AreEqual ("seen", func.ParameterLists [0] [0].PublicName, "wrong public name");
+ ClassicAssert.AreEqual ("seen", func.ParameterLists [0] [0].PrivateName, "wrong private name");
+ ClassicAssert.IsTrue (func.ParameterLists [0] [0].NameIsRequired, "Wrong name requirement");
}
[TestCase (ReflectorMode.Parser)]
@@ -961,14 +962,14 @@ public void TestNotRequiredParamName (ReflectorMode mode)
{
string code = "public func foo(_ seen:Int) { }\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.FirstOrDefault (f => f.Name == "foo");
- Assert.IsNotNull (func, "no function");
- Assert.AreEqual (1, func.ParameterLists.Count, "wrong number of parameter lists");
- Assert.AreEqual (1, func.ParameterLists [0].Count, "wrong number of parameters");
- Assert.AreEqual ("", func.ParameterLists [0] [0].PublicName, "wrong public name");
- Assert.AreEqual ("seen", func.ParameterLists [0] [0].PrivateName, "wrong private name");
- Assert.IsFalse (func.ParameterLists [0] [0].NameIsRequired, "Wrong name requirement");
+ ClassicAssert.IsNotNull (func, "no function");
+ ClassicAssert.AreEqual (1, func.ParameterLists.Count, "wrong number of parameter lists");
+ ClassicAssert.AreEqual (1, func.ParameterLists [0].Count, "wrong number of parameters");
+ ClassicAssert.AreEqual ("", func.ParameterLists [0] [0].PublicName, "wrong public name");
+ ClassicAssert.AreEqual ("seen", func.ParameterLists [0] [0].PrivateName, "wrong private name");
+ ClassicAssert.IsFalse (func.ParameterLists [0] [0].NameIsRequired, "Wrong name requirement");
}
[TestCase (ReflectorMode.Parser)]
@@ -977,13 +978,13 @@ public void TestSimpleVariadicFunc (ReflectorMode mode)
{
string code = "public func itemsAsArray (a:Int ...) -> [Int] {\n return a\n}\n";
var module = ReflectToModules (code, "SomeModule").Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.FirstOrDefault (f => f.Name == "itemsAsArray");
- Assert.IsNotNull (func, "no function");
- Assert.AreEqual (1, func.ParameterLists.Count, "wrong number of parameter lists");
- Assert.AreEqual (1, func.ParameterLists [0].Count, "wrong number of parameters");
- Assert.IsTrue (func.ParameterLists [0] [0].IsVariadic, "Parameter item is not marked variadic");
- Assert.IsTrue (func.IsVariadic, "Func is not mared variadic");
+ ClassicAssert.IsNotNull (func, "no function");
+ ClassicAssert.AreEqual (1, func.ParameterLists.Count, "wrong number of parameter lists");
+ ClassicAssert.AreEqual (1, func.ParameterLists [0].Count, "wrong number of parameters");
+ ClassicAssert.IsTrue (func.ParameterLists [0] [0].IsVariadic, "Parameter item is not marked variadic");
+ ClassicAssert.IsTrue (func.IsVariadic, "Func is not mared variadic");
}
[TestCase (ReflectorMode.Parser)]
@@ -992,13 +993,13 @@ public void TestSimpleNotVariadicFunc (ReflectorMode mode)
{
string code = "public func itemsAsArray (a:Int) -> [Int] {\n return [a]\n}\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.FirstOrDefault (f => f.Name == "itemsAsArray");
- Assert.IsNotNull (func, "no function");
- Assert.AreEqual (1, func.ParameterLists.Count, "wrong number of parameter lists");
- Assert.AreEqual (1, func.ParameterLists [0].Count, "wrong number of parameters");
- Assert.IsFalse (func.ParameterLists [0] [0].IsVariadic, "Parameter item is not marked variadic");
- Assert.IsFalse (func.IsVariadic, "Func is not mared variadic");
+ ClassicAssert.IsNotNull (func, "no function");
+ ClassicAssert.AreEqual (1, func.ParameterLists.Count, "wrong number of parameter lists");
+ ClassicAssert.AreEqual (1, func.ParameterLists [0].Count, "wrong number of parameters");
+ ClassicAssert.IsFalse (func.ParameterLists [0] [0].IsVariadic, "Parameter item is not marked variadic");
+ ClassicAssert.IsFalse (func.IsVariadic, "Func is not mared variadic");
}
[TestCase (ReflectorMode.Parser)]
@@ -1014,15 +1015,15 @@ public func itMightBeAProtocol () -> Foo? {
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.FirstOrDefault (f => f.Name == "itMightBeAProtocol");
- Assert.IsNotNull (func, "no function");
+ ClassicAssert.IsNotNull (func, "no function");
var returnType = func.ReturnTypeSpec as NamedTypeSpec;
- Assert.IsNotNull (returnType, "not a named type spec");
- Assert.IsTrue (returnType.GenericParameters.Count == 1, "Expected 1 generic parameter");
+ ClassicAssert.IsNotNull (returnType, "not a named type spec");
+ ClassicAssert.IsTrue (returnType.GenericParameters.Count == 1, "Expected 1 generic parameter");
var boundType = returnType.GenericParameters [0] as NamedTypeSpec;
- Assert.IsNotNull (boundType, "wrong kind of bound type");
- Assert.AreEqual ("SomeModule.Foo", boundType.Name, "Wrong bound type name");
+ ClassicAssert.IsNotNull (boundType, "wrong kind of bound type");
+ ClassicAssert.AreEqual ("SomeModule.Foo", boundType.Name, "Wrong bound type name");
}
@@ -1040,17 +1041,17 @@ public init () { }
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var cl = module.Classes.FirstOrDefault (c => c.Name == "Container");
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var prop = cl.AllProperties ().FirstOrDefault (p => p.Name == "itMightBeAProtocol");
- Assert.IsNotNull (prop, "no prop");
+ ClassicAssert.IsNotNull (prop, "no prop");
var returnType = prop.TypeSpec as NamedTypeSpec;
- Assert.IsNotNull (returnType, "not a named type spec");
- Assert.IsTrue (returnType.GenericParameters.Count == 1, "Expected 1 generic parameter");
+ ClassicAssert.IsNotNull (returnType, "not a named type spec");
+ ClassicAssert.IsTrue (returnType.GenericParameters.Count == 1, "Expected 1 generic parameter");
var boundType = returnType.GenericParameters [0] as NamedTypeSpec;
- Assert.IsNotNull (boundType, "wrong kind of bound type");
- Assert.AreEqual ("SomeModule.Foo", boundType.Name, "Wrong bound type name");
+ ClassicAssert.IsNotNull (boundType, "wrong kind of bound type");
+ ClassicAssert.AreEqual ("SomeModule.Foo", boundType.Name, "Wrong bound type name");
}
@@ -1071,16 +1072,16 @@ public convenience init (intval: Int) {
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var cl = module.Classes.FirstOrDefault (c => c.Name == "Foo");
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
foreach (var ctor in cl.AllConstructors ()) {
var item = ctor.ParameterLists.Last ().Last ();
if (item.PublicName == "val")
- Assert.IsFalse (ctor.IsConvenienceInit, "designated ctor marked convenience");
+ ClassicAssert.IsFalse (ctor.IsConvenienceInit, "designated ctor marked convenience");
else
- Assert.IsTrue (ctor.IsConvenienceInit, "convenience ctor marked designated");
+ ClassicAssert.IsTrue (ctor.IsConvenienceInit, "convenience ctor marked designated");
}
}
@@ -1099,14 +1100,14 @@ public func joe (a: FooA & FooB) {
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.FirstOrDefault (fn => fn.Name == "joe");
- Assert.IsNotNull (func, "no func");
+ ClassicAssert.IsNotNull (func, "no func");
var parm = func.ParameterLists [0] [0];
var protoList = parm.TypeSpec as ProtocolListTypeSpec;
- Assert.IsNotNull (protoList, "not a proto list");
- Assert.AreEqual (2, protoList.Protocols.Count, "wrong protocol list count");
+ ClassicAssert.IsNotNull (protoList, "not a proto list");
+ ClassicAssert.AreEqual (2, protoList.Protocols.Count, "wrong protocol list count");
}
[TestCase (ReflectorMode.Parser)]
@@ -1118,13 +1119,13 @@ public func returnsAny() -> Any {
return 7
}";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.FirstOrDefault (fn => fn.Name == "returnsAny");
- Assert.IsNotNull (func, "no func");
+ ClassicAssert.IsNotNull (func, "no func");
var returnType = func.ReturnTypeSpec as NamedTypeSpec;
- Assert.IsNotNull (returnType, "no return type");
- Assert.AreEqual ("Swift.Any", returnType.Name, $"Wrong type: {returnType.Name}");
+ ClassicAssert.IsNotNull (returnType, "no return type");
+ ClassicAssert.AreEqual ("Swift.Any", returnType.Name, $"Wrong type: {returnType.Name}");
}
[TestCase (ReflectorMode.Parser)]
@@ -1138,15 +1139,15 @@ func getThing() -> Thing
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var protocol = module.Protocols.Where (p => p.Name == "HoldsThing").FirstOrDefault ();
- Assert.IsNotNull (protocol, "no protocol");
- Assert.AreEqual (1, protocol.AssociatedTypes.Count, "no associated types");
+ ClassicAssert.IsNotNull (protocol, "no protocol");
+ ClassicAssert.AreEqual (1, protocol.AssociatedTypes.Count, "no associated types");
var assoc = protocol.AssociatedTypes [0];
- Assert.AreEqual ("Thing", assoc.Name, "wrong name");
- Assert.AreEqual (0, assoc.ConformingProtocols.Count, "wrong number of conf");
- Assert.IsNull (assoc.SuperClass, "non-null superclass");
- Assert.IsNull (assoc.DefaultType, "non-null default type");
+ ClassicAssert.AreEqual ("Thing", assoc.Name, "wrong name");
+ ClassicAssert.AreEqual (0, assoc.ConformingProtocols.Count, "wrong number of conf");
+ ClassicAssert.IsNull (assoc.SuperClass, "non-null superclass");
+ ClassicAssert.IsNull (assoc.DefaultType, "non-null default type");
}
[TestCase (ReflectorMode.Parser)]
@@ -1161,17 +1162,17 @@ func doThing(a: ThingOne) -> ThingTwo
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var protocol = module.Protocols.Where (p => p.Name == "HoldsThing").FirstOrDefault ();
- Assert.IsNotNull (protocol, "no protocol");
- Assert.AreEqual (2, protocol.AssociatedTypes.Count, "no associated types");
+ ClassicAssert.IsNotNull (protocol, "no protocol");
+ ClassicAssert.AreEqual (2, protocol.AssociatedTypes.Count, "no associated types");
var assoc = protocol.AssociatedTypes [0];
- Assert.AreEqual ("ThingOne", assoc.Name, "wrong name");
+ ClassicAssert.AreEqual ("ThingOne", assoc.Name, "wrong name");
assoc = protocol.AssociatedTypes [1];
- Assert.AreEqual ("ThingTwo", assoc.Name, "wrong name");
- Assert.AreEqual (0, assoc.ConformingProtocols.Count, "wrong number of conf");
- Assert.IsNull (assoc.SuperClass, "non-null superclass");
- Assert.IsNull (assoc.DefaultType, "non-null default type");
+ ClassicAssert.AreEqual ("ThingTwo", assoc.Name, "wrong name");
+ ClassicAssert.AreEqual (0, assoc.ConformingProtocols.Count, "wrong number of conf");
+ ClassicAssert.IsNull (assoc.SuperClass, "non-null superclass");
+ ClassicAssert.IsNull (assoc.DefaultType, "non-null default type");
}
[TestCase (ReflectorMode.Parser)]
@@ -1185,16 +1186,16 @@ func doThing() -> Thing
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var protocol = module.Protocols.Where (p => p.Name == "HoldsThing").FirstOrDefault ();
- Assert.IsNotNull (protocol, "no protocol");
- Assert.AreEqual (1, protocol.AssociatedTypes.Count, "no associated types");
+ ClassicAssert.IsNotNull (protocol, "no protocol");
+ ClassicAssert.AreEqual (1, protocol.AssociatedTypes.Count, "no associated types");
var assoc = protocol.AssociatedTypes [0];
- Assert.AreEqual ("Thing", assoc.Name, "wrong name");
- Assert.AreEqual (0, assoc.ConformingProtocols.Count, "wrong number of conf");
- Assert.IsNull (assoc.SuperClass, "non-null superclass");
- Assert.IsNotNull (assoc.DefaultType, "null default type");
- Assert.AreEqual ("Swift.Int", assoc.DefaultType.ToString (), "wrong type");
+ ClassicAssert.AreEqual ("Thing", assoc.Name, "wrong name");
+ ClassicAssert.AreEqual (0, assoc.ConformingProtocols.Count, "wrong number of conf");
+ ClassicAssert.IsNull (assoc.SuperClass, "non-null superclass");
+ ClassicAssert.IsNotNull (assoc.DefaultType, "null default type");
+ ClassicAssert.AreEqual ("Swift.Int", assoc.DefaultType.ToString (), "wrong type");
}
[TestCase (ReflectorMode.Parser, Ignore = "Don't have IteratorProtocol in type database")]
@@ -1208,16 +1209,16 @@ func doThing() -> Thing
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var protocol = module.Protocols.Where (p => p.Name == "HoldsThing").FirstOrDefault ();
- Assert.IsNotNull (protocol, "no protocol");
- Assert.AreEqual (1, protocol.AssociatedTypes.Count, "no associated types");
+ ClassicAssert.IsNotNull (protocol, "no protocol");
+ ClassicAssert.AreEqual (1, protocol.AssociatedTypes.Count, "no associated types");
var assoc = protocol.AssociatedTypes [0];
- Assert.AreEqual ("Thing", assoc.Name, "wrong name");
- Assert.AreEqual (1, assoc.ConformingProtocols.Count, "wrong number of conf");
- Assert.AreEqual ("Swift.IteratorProtocol", assoc.ConformingProtocols [0].ToString (), "wrong protocol name");
- Assert.IsNull (assoc.SuperClass, "non-null superclass");
- Assert.IsNull (assoc.DefaultType, "non-null default type");
+ ClassicAssert.AreEqual ("Thing", assoc.Name, "wrong name");
+ ClassicAssert.AreEqual (1, assoc.ConformingProtocols.Count, "wrong number of conf");
+ ClassicAssert.AreEqual ("Swift.IteratorProtocol", assoc.ConformingProtocols [0].ToString (), "wrong protocol name");
+ ClassicAssert.IsNull (assoc.SuperClass, "non-null superclass");
+ ClassicAssert.IsNull (assoc.DefaultType, "non-null default type");
}
@@ -1236,16 +1237,16 @@ func doThing() -> Thing
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var protocol = module.Protocols.Where (p => p.Name == "HoldsThing").FirstOrDefault ();
- Assert.IsNotNull (protocol, "no protocol");
- Assert.AreEqual (1, protocol.AssociatedTypes.Count, "no associated types");
+ ClassicAssert.IsNotNull (protocol, "no protocol");
+ ClassicAssert.AreEqual (1, protocol.AssociatedTypes.Count, "no associated types");
var assoc = protocol.AssociatedTypes [0];
- Assert.AreEqual ("Thing", assoc.Name, "wrong name");
- Assert.AreEqual (0, assoc.ConformingProtocols.Count, "wrong number of conf");
- Assert.IsNotNull (assoc.SuperClass, "null superclass");
- Assert.AreEqual ("SomeModule.Foo", assoc.SuperClass.ToString (), "wrong superclass name");
- Assert.IsNull (assoc.DefaultType, "non-null default type");
+ ClassicAssert.AreEqual ("Thing", assoc.Name, "wrong name");
+ ClassicAssert.AreEqual (0, assoc.ConformingProtocols.Count, "wrong number of conf");
+ ClassicAssert.IsNotNull (assoc.SuperClass, "null superclass");
+ ClassicAssert.AreEqual ("SomeModule.Foo", assoc.SuperClass.ToString (), "wrong superclass name");
+ ClassicAssert.IsNull (assoc.DefaultType, "non-null default type");
}
[TestCase (ReflectorMode.Parser)]
@@ -1259,14 +1260,14 @@ func doThing() -> Thing
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var protocol = module.Protocols.Where (p => p.Name == "HoldsThing").FirstOrDefault ();
- Assert.IsNotNull (protocol, "no protocol");
- Assert.IsTrue (protocol.HasAssociatedTypes, "no associated types?!");
+ ClassicAssert.IsNotNull (protocol, "no protocol");
+ ClassicAssert.IsTrue (protocol.HasAssociatedTypes, "no associated types?!");
var assoc = protocol.AssociatedTypeNamed ("Thing");
- Assert.IsNotNull (assoc, "couldn't find associated type");
+ ClassicAssert.IsNotNull (assoc, "couldn't find associated type");
assoc = protocol.AssociatedTypeNamed ("ThroatwarblerMangrove");
- Assert.IsNull (assoc, "Found a non-existent associated type");
+ ClassicAssert.IsNull (assoc, "Found a non-existent associated type");
}
[TestCase (ReflectorMode.Parser)]
@@ -1275,11 +1276,11 @@ public void TestTLFuncNoArgsNoReturnOutput (ReflectorMode mode)
{
var code = @"public func SomeFunc () { }";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.Where (f => f.Name == "SomeFunc").FirstOrDefault ();
- Assert.IsNotNull (func, "null func");
+ ClassicAssert.IsNotNull (func, "null func");
var output = func.ToString ();
- Assert.AreEqual ("Public SomeModule.SomeFunc () -> ()", output, "wrong signature");
+ ClassicAssert.AreEqual ("Public SomeModule.SomeFunc () -> ()", output, "wrong signature");
}
[TestCase (ReflectorMode.Parser)]
@@ -1288,11 +1289,11 @@ public void TestTLFuncNoArgsReturnsIntOutput (ReflectorMode mode)
{
var code = @"public func SomeFunc () -> Int { return 3; }";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.Where (f => f.Name == "SomeFunc").FirstOrDefault ();
- Assert.IsNotNull (func, "null func");
+ ClassicAssert.IsNotNull (func, "null func");
var output = func.ToString ();
- Assert.AreEqual ("Public SomeModule.SomeFunc () -> Swift.Int", output, "wrong signature");
+ ClassicAssert.AreEqual ("Public SomeModule.SomeFunc () -> Swift.Int", output, "wrong signature");
}
[TestCase (ReflectorMode.Parser)]
@@ -1301,11 +1302,11 @@ public void TestTLFuncNoArgsReturnsIntThrowsOutput (ReflectorMode mode)
{
var code = @"public func SomeFunc () throws -> Int { return 3; }";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.Where (f => f.Name == "SomeFunc").FirstOrDefault ();
- Assert.IsNotNull (func, "null func");
+ ClassicAssert.IsNotNull (func, "null func");
var output = func.ToString ();
- Assert.AreEqual ("Public SomeModule.SomeFunc () throws -> Swift.Int", output, "wrong signature");
+ ClassicAssert.AreEqual ("Public SomeModule.SomeFunc () throws -> Swift.Int", output, "wrong signature");
}
[TestCase (ReflectorMode.Parser)]
@@ -1314,11 +1315,11 @@ public void TestTLFuncOneArgSamePubPrivReturnsInt (ReflectorMode mode)
{
var code = @"public func SomeFunc (a: Int) -> Int { return a; }";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.Where (f => f.Name == "SomeFunc").FirstOrDefault ();
- Assert.IsNotNull (func, "null func");
+ ClassicAssert.IsNotNull (func, "null func");
var output = func.ToString ();
- Assert.AreEqual ("Public SomeModule.SomeFunc (a: Swift.Int) -> Swift.Int", output, "wrong signature");
+ ClassicAssert.AreEqual ("Public SomeModule.SomeFunc (a: Swift.Int) -> Swift.Int", output, "wrong signature");
}
[TestCase (ReflectorMode.Parser)]
@@ -1327,11 +1328,11 @@ public void TestTLFuncOneArgDiffPubPrivReturnsInt (ReflectorMode mode)
{
var code = @"public func SomeFunc (b a: Int) -> Int { return a; }";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.Where (f => f.Name == "SomeFunc").FirstOrDefault ();
- Assert.IsNotNull (func, "null func");
+ ClassicAssert.IsNotNull (func, "null func");
var output = func.ToString ();
- Assert.AreEqual ("Public SomeModule.SomeFunc (b a: Swift.Int) -> Swift.Int", output, "wrong signature");
+ ClassicAssert.AreEqual ("Public SomeModule.SomeFunc (b a: Swift.Int) -> Swift.Int", output, "wrong signature");
}
[TestCase (ReflectorMode.Parser)]
@@ -1340,11 +1341,11 @@ public void TestTLFuncOneArgNoPubPrivReturnsInt (ReflectorMode mode)
{
var code = @"public func SomeFunc (_ a: Int) -> Int { return a; }";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.Where (f => f.Name == "SomeFunc").FirstOrDefault ();
- Assert.IsNotNull (func, "null func");
+ ClassicAssert.IsNotNull (func, "null func");
var output = func.ToString ();
- Assert.AreEqual ("Public SomeModule.SomeFunc (_ a: Swift.Int) -> Swift.Int", output, "wrong signature");
+ ClassicAssert.AreEqual ("Public SomeModule.SomeFunc (_ a: Swift.Int) -> Swift.Int", output, "wrong signature");
}
[TestCase (ReflectorMode.Parser)]
@@ -1353,11 +1354,11 @@ public void TestTLFuncTwoArgSamePubPrivReturnsInt (ReflectorMode mode)
{
var code = @"public func SomeFunc (a: Int, b: Int) -> Int { return a + b; }";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.TopLevelFunctions.Where (f => f.Name == "SomeFunc").FirstOrDefault ();
- Assert.IsNotNull (func, "null func");
+ ClassicAssert.IsNotNull (func, "null func");
var output = func.ToString ();
- Assert.AreEqual ("Public SomeModule.SomeFunc (a: Swift.Int, b: Swift.Int) -> Swift.Int", output, "wrong signature");
+ ClassicAssert.AreEqual ("Public SomeModule.SomeFunc (a: Swift.Int, b: Swift.Int) -> Swift.Int", output, "wrong signature");
}
[TestCase (ReflectorMode.Parser)]
@@ -1371,13 +1372,13 @@ public init () { }
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var cl = module.Classes.Where (c => c.Name == "Foo").FirstOrDefault ();
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var func = cl.AllMethodsNoCDTor ().Where (p => p.Name == "get_prop").FirstOrDefault ();
- Assert.IsNotNull (func, "null func");
+ ClassicAssert.IsNotNull (func, "null func");
var output = func.ToString ();
- Assert.AreEqual ("Public var SomeModule.Foo.prop: Swift.Int { get }", output, "wrong signature");
+ ClassicAssert.AreEqual ("Public var SomeModule.Foo.prop: Swift.Int { get }", output, "wrong signature");
}
[TestCase (ReflectorMode.Parser)]
@@ -1391,13 +1392,13 @@ public init () { }
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var cl = module.Classes.Where (c => c.Name == "Foo").FirstOrDefault ();
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var func = cl.AllProperties ().Where (p => p.Name == "prop").FirstOrDefault ();
- Assert.IsNotNull (func, "null func");
+ ClassicAssert.IsNotNull (func, "null func");
var output = func.ToString ();
- Assert.AreEqual ("Public var SomeModule.Foo.prop: Swift.Int { get set }", output, "wrong signature");
+ ClassicAssert.AreEqual ("Public var SomeModule.Foo.prop: Swift.Int { get set }", output, "wrong signature");
}
[TestCase (ReflectorMode.Parser)]
@@ -1410,15 +1411,15 @@ public init () { }
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var cl = module.Classes.Where (c => c.Name == "Foo").FirstOrDefault ();
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var ctor = cl.AllConstructors ().FirstOrDefault ();
- Assert.IsNotNull (ctor, "no constructor");
+ ClassicAssert.IsNotNull (ctor, "no constructor");
var pl = ctor.ParameterLists [0];
- Assert.AreEqual (1, pl.Count, "wrong number of parameters");
+ ClassicAssert.AreEqual (1, pl.Count, "wrong number of parameters");
var uncurriedType = pl [0].TypeName;
- Assert.AreEqual ("SomeModule.Foo.Type", uncurriedType, "wrong type");
+ ClassicAssert.AreEqual ("SomeModule.Foo.Type", uncurriedType, "wrong type");
}
@@ -1438,13 +1439,13 @@ public subscript (Index: Int) -> String {
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var cl = module.Classes.Where (c => c.Name == "Foo").FirstOrDefault ();
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var func = cl.AllMethodsNoCDTor ().Where (p => p.Name == "get_subscript").FirstOrDefault ();
- Assert.IsNotNull (func, "null func");
+ ClassicAssert.IsNotNull (func, "null func");
var output = func.ToString ();
- Assert.AreEqual ("Public SomeModule.Foo.subscript [_ Index: Swift.Int] -> Swift.String { get }", output, "wrong signature");
+ ClassicAssert.AreEqual ("Public SomeModule.Foo.subscript [_ Index: Swift.Int] -> Swift.String { get }", output, "wrong signature");
}
[TestCase (ReflectorMode.Parser)]
@@ -1462,12 +1463,12 @@ public func printIt(a: U) {
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var cl = module.Classes.Where (c => c.Name == "Foo").FirstOrDefault ();
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var func = cl.AllMethodsNoCDTor ().Where (p => p.Name == "printIt").FirstOrDefault ();
var output = func.ToString ();
- Assert.AreEqual ("Public SomeModule.Foo.printIt (a: U) -> ()", output, "wrong signature");
+ ClassicAssert.AreEqual ("Public SomeModule.Foo.printIt (a: U) -> ()", output, "wrong signature");
}
[TestCase (ReflectorMode.Parser)]
@@ -1480,10 +1481,10 @@ func whoami() -> Self
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var proto = module.Protocols.Where (p => p.Name == "Simple").FirstOrDefault ();
- Assert.IsNotNull (proto, "no protocol");
- Assert.IsTrue (proto.HasDynamicSelf, "no dynamic self");
+ ClassicAssert.IsNotNull (proto, "no protocol");
+ ClassicAssert.IsTrue (proto.HasDynamicSelf, "no dynamic self");
}
[TestCase (ReflectorMode.Parser)]
@@ -1500,10 +1501,10 @@ func whoami(a: Self) -> Thing
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var proto = module.Protocols.Where (p => p.Name == "Simple").FirstOrDefault ();
- Assert.IsNotNull (proto, "no protocol");
- Assert.IsTrue (proto.HasDynamicSelf, "no dynamic self");
+ ClassicAssert.IsNotNull (proto, "no protocol");
+ ClassicAssert.IsTrue (proto.HasDynamicSelf, "no dynamic self");
}
[TestCase (ReflectorMode.Parser)]
@@ -1516,10 +1517,10 @@ func whoami() -> (Int, Bool, Self)
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var proto = module.Protocols.Where (p => p.Name == "Simple").FirstOrDefault ();
- Assert.IsNotNull (proto, "no protocol");
- Assert.IsTrue (proto.HasDynamicSelf, "no dynamic self");
+ ClassicAssert.IsNotNull (proto, "no protocol");
+ ClassicAssert.IsTrue (proto.HasDynamicSelf, "no dynamic self");
}
[TestCase (ReflectorMode.Parser)]
@@ -1532,10 +1533,10 @@ func whoami() -> Self?
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var proto = module.Protocols.Where (p => p.Name == "Simple").FirstOrDefault ();
- Assert.IsNotNull (proto, "no protocol");
- Assert.IsTrue (proto.HasDynamicSelf, "no dynamic self");
+ ClassicAssert.IsNotNull (proto, "no protocol");
+ ClassicAssert.IsTrue (proto.HasDynamicSelf, "no dynamic self");
}
[TestCase (ReflectorMode.Parser)]
@@ -1548,10 +1549,10 @@ func whoami() -> UnsafeMutablePointer
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var proto = module.Protocols.Where (p => p.Name == "Simple").FirstOrDefault ();
- Assert.IsNotNull (proto, "no protocol");
- Assert.IsTrue (proto.HasDynamicSelf, "no dynamic self");
+ ClassicAssert.IsNotNull (proto, "no protocol");
+ ClassicAssert.IsTrue (proto.HasDynamicSelf, "no dynamic self");
}
[TestCase (ReflectorMode.Parser)]
@@ -1564,10 +1565,10 @@ func whoami(a: (Self)->()) -> ()
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var proto = module.Protocols.Where (p => p.Name == "Simple").FirstOrDefault ();
- Assert.IsNotNull (proto, "no protocol");
- Assert.IsTrue (proto.HasDynamicSelf, "no dynamic self");
+ ClassicAssert.IsNotNull (proto, "no protocol");
+ ClassicAssert.IsTrue (proto.HasDynamicSelf, "no dynamic self");
}
[TestCase (ReflectorMode.Parser, Ignore = "not coming through as a let - apple's bug, not mine: https://bugs.swift.org/browse/SR-13790")]
@@ -1576,11 +1577,11 @@ public void TopLevelLet (ReflectorMode mode)
{
var code = "public let myVar:Int = 42";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var prop = module.Properties.Where (p => p.Name == "myVar").FirstOrDefault ();
- Assert.IsNotNull (prop, "no prop");
- Assert.IsTrue (prop.IsLet, "not a let");
- Assert.IsNull (prop.GetSetter (), "why is there a setter");
+ ClassicAssert.IsNotNull (prop, "no prop");
+ ClassicAssert.IsTrue (prop.IsLet, "not a let");
+ ClassicAssert.IsNull (prop.GetSetter (), "why is there a setter");
}
@@ -1590,11 +1591,11 @@ public void TheEpsilonIssue (ReflectorMode mode)
{
string code = "public let 𝑒 = 2.718\n";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var prop = module.Properties.Where (p => p.Name == "𝑒").FirstOrDefault ();
- Assert.IsNotNull (prop, "no prop");
- Assert.IsTrue (prop.IsLet, "not a let");
- Assert.IsNull (prop.GetSetter (), "why is there a setter");
+ ClassicAssert.IsNotNull (prop, "no prop");
+ ClassicAssert.IsTrue (prop.IsLet, "not a let");
+ ClassicAssert.IsNull (prop.GetSetter (), "why is there a setter");
}
[TestCase (ReflectorMode.Parser)]
@@ -1609,11 +1610,11 @@ extension Int {
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var opDecl = module.Operators.Where (op => op.Name == "*^*").FirstOrDefault ();
- Assert.AreEqual ("*^*", opDecl.Name, "name mismatch");
- Assert.AreEqual ("AdditionPrecedence", opDecl.PrecedenceGroup, "predence group mismatch");
- Assert.AreEqual (OperatorType.Infix, opDecl.OperatorType, "operator type mismatch");
+ ClassicAssert.AreEqual ("*^*", opDecl.Name, "name mismatch");
+ ClassicAssert.AreEqual ("AdditionPrecedence", opDecl.PrecedenceGroup, "predence group mismatch");
+ ClassicAssert.AreEqual (OperatorType.Infix, opDecl.OperatorType, "operator type mismatch");
}
[TestCase (ReflectorMode.Parser)]
@@ -1628,11 +1629,11 @@ extension Int {
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var opDecl = module.Operators.Where (op => op.Name == "*^^*").FirstOrDefault ();
- Assert.AreEqual ("*^^*", opDecl.Name, "name mismatch");
- Assert.IsNull (opDecl.PrecedenceGroup, "predence group mismatch");
- Assert.AreEqual (OperatorType.Prefix, opDecl.OperatorType, "operator type mismatch");
+ ClassicAssert.AreEqual ("*^^*", opDecl.Name, "name mismatch");
+ ClassicAssert.IsNull (opDecl.PrecedenceGroup, "predence group mismatch");
+ ClassicAssert.AreEqual (OperatorType.Prefix, opDecl.OperatorType, "operator type mismatch");
}
[TestCase (ReflectorMode.Parser)]
@@ -1647,11 +1648,11 @@ extension Int {
}
";
var module = ReflectToModules (code, "SomeModule", mode).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var opDecl = module.Operators.Where (op => op.Name == "*^&^*").FirstOrDefault ();
- Assert.AreEqual ("*^&^*", opDecl.Name, "name mismatch");
- Assert.IsNull (opDecl.PrecedenceGroup, "predence group mismatch");
- Assert.AreEqual (OperatorType.Postfix, opDecl.OperatorType, "operator type mismatch");
+ ClassicAssert.AreEqual ("*^&^*", opDecl.Name, "name mismatch");
+ ClassicAssert.IsNull (opDecl.PrecedenceGroup, "predence group mismatch");
+ ClassicAssert.AreEqual (OperatorType.Postfix, opDecl.OperatorType, "operator type mismatch");
}
[Test]
@@ -1664,12 +1665,12 @@ public func sum (a: Foo, b: Foo) -> Foo {
}
";
var module = ReflectToModules (code, "SomeModule", ReflectorMode.Parser).FirstOrDefault (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
- Assert.AreEqual (1, module.TypeAliases.Count, "wrong number of typealiases");
+ ClassicAssert.IsNotNull (module, "module is null");
+ ClassicAssert.AreEqual (1, module.TypeAliases.Count, "wrong number of typealiases");
var alias = module.TypeAliases [0];
- Assert.AreEqual (Accessibility.Public, alias.Access, "wrong access");
- Assert.AreEqual ("SomeModule.Foo", alias.TypeName, "wrong typealias name");
- Assert.AreEqual ("Swift.Int", alias.TargetTypeName, "wrong typealias target");
+ ClassicAssert.AreEqual (Accessibility.Public, alias.Access, "wrong access");
+ ClassicAssert.AreEqual ("SomeModule.Foo", alias.TypeName, "wrong typealias name");
+ ClassicAssert.AreEqual ("Swift.Int", alias.TargetTypeName, "wrong typealias target");
}
[TestCase (ReflectorMode.Parser)]
@@ -1683,10 +1684,10 @@ public func sum (a: Int!, b: Int!) -> Int! {
";
var module = ReflectToModules (code, "SomeModule", mode).FirstOrDefault (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var func = module.Functions.Where (fn => fn.Name == "sum").FirstOrDefault ();
- Assert.IsNotNull (func, "no func");
- Assert.AreEqual ("Swift.Optional", func.ReturnTypeName);
+ ClassicAssert.IsNotNull (func, "no func");
+ ClassicAssert.AreEqual ("Swift.Optional", func.ReturnTypeName);
}
@@ -1700,11 +1701,11 @@ public enum E : Error {
}
";
var module = ReflectToModules (code, "SomeModule", mode).FirstOrDefault (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var en = module.Enums.FirstOrDefault (e => e.Name == "E");
- Assert.IsNotNull (en, "no enum");
- Assert.AreEqual (1, en.Inheritance.Count, "wrong inheritance count");
- Assert.AreEqual ("Swift.Error", en.Inheritance [0].InheritedTypeName, "wrong inherited name");
+ ClassicAssert.IsNotNull (en, "no enum");
+ ClassicAssert.AreEqual (1, en.Inheritance.Count, "wrong inheritance count");
+ ClassicAssert.AreEqual ("Swift.Error", en.Inheritance [0].InheritedTypeName, "wrong inherited name");
}
[TestCase (ReflectorMode.Parser)]
@@ -1719,10 +1720,10 @@ public func sum (a:Int, b:Int) -> Int {
}
";
var module = ReflectToModules (code, "SomeModule", mode).FirstOrDefault (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module is null");
+ ClassicAssert.IsNotNull (module, "module is null");
var fn = module.TopLevelFunctions.FirstOrDefault (f => f.Name == "sum");
- Assert.IsNotNull (fn, "no function");
+ ClassicAssert.IsNotNull (fn, "no function");
}
[TestCase (ReflectorMode.Parser)]
@@ -1735,12 +1736,12 @@ public struct Foo {
}
";
var module = ReflectToModules (code, "SomeModule", mode).FirstOrDefault (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var cl = module.Structs.FirstOrDefault (c => c.Name == "Foo");
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var prop = cl.AllProperties ().FirstOrDefault (p => p.Name == "X");
- Assert.IsNotNull (prop, "no prop");
+ ClassicAssert.IsNotNull (prop, "no prop");
}
}
}
diff --git a/tests/tom-swifty-test/XmlReflectionTests/GenerativeTests.cs b/tests/tom-swifty-test/XmlReflectionTests/GenerativeTests.cs
index 489c508b..56bce810 100644
--- a/tests/tom-swifty-test/XmlReflectionTests/GenerativeTests.cs
+++ b/tests/tom-swifty-test/XmlReflectionTests/GenerativeTests.cs
@@ -13,6 +13,7 @@
using System.Text;
using System.Xml.Linq;
using SwiftReflector.SwiftInterfaceReflector;
+using NUnit.Framework.Legacy;
namespace XmlReflectionTests {
[TestFixture]
@@ -57,16 +58,16 @@ public void TestRootedAndUnrooted ()
{
ModuleDeclaration module = ReflectToModules ("public class Foo { } ", "SomeModule").Find (m => m.Name == "SomeModule");
ClassDeclaration fooClass = module.AllClasses.Where (cl => cl.Name == "Foo").FirstOrDefault ();
- Assert.IsNotNull (fooClass);
- Assert.IsFalse (fooClass.IsUnrooted);
+ ClassicAssert.IsNotNull (fooClass);
+ ClassicAssert.IsFalse (fooClass.IsUnrooted);
ClassDeclaration unrootedFoo = fooClass.MakeUnrooted () as ClassDeclaration;
- Assert.IsNotNull (unrootedFoo);
- Assert.IsTrue (unrootedFoo != fooClass);
- Assert.AreEqual (unrootedFoo.Name, fooClass.Name);
- Assert.AreEqual (unrootedFoo.Access, fooClass.Access);
+ ClassicAssert.IsNotNull (unrootedFoo);
+ ClassicAssert.IsTrue (unrootedFoo != fooClass);
+ ClassicAssert.AreEqual (unrootedFoo.Name, fooClass.Name);
+ ClassicAssert.AreEqual (unrootedFoo.Access, fooClass.Access);
ClassDeclaration doubleUnrootedFoo = unrootedFoo.MakeUnrooted () as ClassDeclaration;
- Assert.IsNotNull (doubleUnrootedFoo);
- Assert.IsTrue (doubleUnrootedFoo == unrootedFoo);
+ ClassicAssert.IsNotNull (doubleUnrootedFoo);
+ ClassicAssert.IsTrue (doubleUnrootedFoo == unrootedFoo);
}
[Test]
@@ -75,7 +76,7 @@ public void RoundTripClass ()
ModuleDeclaration module = ReflectToModules ("public class Foo { } ",
"SomeModule").Find (m => m.Name == "SomeModule");
ClassDeclaration fooClass = module.AllClasses.Where (cl => cl.Name == "Foo").FirstOrDefault ();
- Assert.IsNotNull (fooClass);
+ ClassicAssert.IsNotNull (fooClass);
ClassDeclaration unrootedFoo = fooClass.MakeUnrooted () as ClassDeclaration;
Entity entity = new Entity {
@@ -95,10 +96,10 @@ public void RoundTripClass ()
var errors = dbread.Read (ostm);
Utils.CheckErrors (errors);
Entity entityRead = dbread.EntityForSwiftName ("SomeModule.Foo");
- Assert.IsNotNull (entityRead);
- Assert.AreEqual (entity.SharpNamespace, entityRead.SharpNamespace);
- Assert.AreEqual (entity.SharpTypeName, entityRead.SharpTypeName);
- Assert.IsTrue (entity.Type is ClassDeclaration);
+ ClassicAssert.IsNotNull (entityRead);
+ ClassicAssert.AreEqual (entity.SharpNamespace, entityRead.SharpNamespace);
+ ClassicAssert.AreEqual (entity.SharpTypeName, entityRead.SharpTypeName);
+ ClassicAssert.IsTrue (entity.Type is ClassDeclaration);
}
[Test]
@@ -106,7 +107,7 @@ public void RoundTripStruct ()
{
ModuleDeclaration module = ReflectToModules ("public struct Foo {\npublic var x:Int\n } ", "SomeModule").Find (m => m.Name == "SomeModule");
StructDeclaration fooClass = module.AllStructs.Where (cl => cl.Name == "Foo").FirstOrDefault ();
- Assert.IsNotNull (fooClass);
+ ClassicAssert.IsNotNull (fooClass);
StructDeclaration unrootedFoo = fooClass.MakeUnrooted () as StructDeclaration;
Entity entity = new Entity {
@@ -126,10 +127,10 @@ public void RoundTripStruct ()
var errors = dbread.Read (ostm);
Utils.CheckErrors (errors);
Entity entityRead = dbread.EntityForSwiftName ("SomeModule.Foo");
- Assert.IsNotNull (entityRead);
- Assert.AreEqual (entity.SharpNamespace, entityRead.SharpNamespace);
- Assert.AreEqual (entity.SharpTypeName, entityRead.SharpTypeName);
- Assert.IsTrue (entity.Type is StructDeclaration);
+ ClassicAssert.IsNotNull (entityRead);
+ ClassicAssert.AreEqual (entity.SharpNamespace, entityRead.SharpNamespace);
+ ClassicAssert.AreEqual (entity.SharpTypeName, entityRead.SharpTypeName);
+ ClassicAssert.IsTrue (entity.Type is StructDeclaration);
}
[Test]
@@ -137,7 +138,7 @@ public void RoundTripEnum ()
{
ModuleDeclaration module = ReflectToModules ("public enum Foo {\ncase a, b, c\n } ", "SomeModule").Find (m => m.Name == "SomeModule");
EnumDeclaration fooClass = module.AllEnums.Where (cl => cl.Name == "Foo").FirstOrDefault ();
- Assert.IsNotNull (fooClass);
+ ClassicAssert.IsNotNull (fooClass);
EnumDeclaration unrootedFoo = fooClass.MakeUnrooted () as EnumDeclaration;
Entity entity = new Entity {
@@ -157,10 +158,10 @@ public void RoundTripEnum ()
var errors = dbread.Read (ostm);
Utils.CheckErrors (errors);
Entity entityRead = dbread.EntityForSwiftName ("SomeModule.Foo");
- Assert.IsNotNull (entityRead);
- Assert.AreEqual (entity.SharpNamespace, entityRead.SharpNamespace);
- Assert.AreEqual (entity.SharpTypeName, entityRead.SharpTypeName);
- Assert.IsTrue (entity.Type is EnumDeclaration);
+ ClassicAssert.IsNotNull (entityRead);
+ ClassicAssert.AreEqual (entity.SharpNamespace, entityRead.SharpNamespace);
+ ClassicAssert.AreEqual (entity.SharpTypeName, entityRead.SharpTypeName);
+ ClassicAssert.IsTrue (entity.Type is EnumDeclaration);
}
@@ -170,15 +171,15 @@ public void ContainsEscapingAttribute ()
var module = ReflectToModules (
"public func SomeFunction(a: @escaping ()->()) {\n a() \n}\n", "SomeModule").Find (m => m.Name == "SomeModule");
var func = module.AllTypesAndTopLevelDeclarations.OfType ().FirstOrDefault ();
- Assert.IsNotNull (func);
+ ClassicAssert.IsNotNull (func);
- Assert.AreEqual (1, func.ParameterLists.Count);
- Assert.AreEqual (1, func.ParameterLists [0].Count);
+ ClassicAssert.AreEqual (1, func.ParameterLists.Count);
+ ClassicAssert.AreEqual (1, func.ParameterLists [0].Count);
var paramItem = func.ParameterLists [0] [0];
var spec = paramItem.TypeSpec;
- Assert.AreEqual (1, spec.Attributes.Count ());
- Assert.AreEqual ("escaping", spec.Attributes [0].Name);
+ ClassicAssert.AreEqual (1, spec.Attributes.Count ());
+ ClassicAssert.AreEqual ("escaping", spec.Attributes [0].Name);
}
@@ -188,14 +189,14 @@ public void NoEscapingAttribute ()
var module = ReflectToModules (
"public func SomeFunction(a: ()->()) {\n a() \n}\n", "SomeModule").Find (m => m.Name == "SomeModule");
var func = module.AllTypesAndTopLevelDeclarations.OfType ().FirstOrDefault ();
- Assert.IsNotNull (func);
+ ClassicAssert.IsNotNull (func);
- Assert.AreEqual (1, func.ParameterLists.Count);
- Assert.AreEqual (1, func.ParameterLists [0].Count);
+ ClassicAssert.AreEqual (1, func.ParameterLists.Count);
+ ClassicAssert.AreEqual (1, func.ParameterLists [0].Count);
var paramItem = func.ParameterLists [0] [0];
var spec = paramItem.TypeSpec;
- Assert.AreEqual (0, spec.Attributes.Count ());
+ ClassicAssert.AreEqual (0, spec.Attributes.Count ());
}
[Test]
@@ -203,15 +204,15 @@ public void HasAnyAttribute ()
{
var module = ReflectToModules (
"public func SomeFunction (a: any Equatable) { }\n", "SomeModule").FirstOrDefault ();
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var func = module.AllTypesAndTopLevelDeclarations.OfType ().FirstOrDefault ();
- Assert.IsNotNull (func, "no function");
- Assert.AreEqual (1, func.ParameterLists.Count, "wrong number of parameter lists");
- Assert.AreEqual (1, func.ParameterLists [0].Count, "wong number of parameters");
+ ClassicAssert.IsNotNull (func, "no function");
+ ClassicAssert.AreEqual (1, func.ParameterLists.Count, "wrong number of parameter lists");
+ ClassicAssert.AreEqual (1, func.ParameterLists [0].Count, "wong number of parameters");
var paramItem = func.ParameterLists [0] [0];
var spec = paramItem.TypeSpec;
- Assert.IsTrue (spec.IsAny, "didn't find 'any'");
+ ClassicAssert.IsTrue (spec.IsAny, "didn't find 'any'");
}
}
}
diff --git a/tests/tom-swifty-test/XmlReflectionTests/StaticXmlTests.cs b/tests/tom-swifty-test/XmlReflectionTests/StaticXmlTests.cs
index b6f3eb72..b879162f 100644
--- a/tests/tom-swifty-test/XmlReflectionTests/StaticXmlTests.cs
+++ b/tests/tom-swifty-test/XmlReflectionTests/StaticXmlTests.cs
@@ -6,6 +6,7 @@
using NUnit.Framework;
using SwiftReflector.SwiftXmlReflection;
using System.Collections.Generic;
+using NUnit.Framework.Legacy;
namespace XmlReflectionTests {
[TestFixture]
@@ -28,21 +29,21 @@ public void SingleFunctionInModule ()
" " +
"";
List modules = Reflector.FromXml (xmlText, typeDatabase: null);
- Assert.NotNull (modules);
- Assert.AreEqual (1, modules.Count);
- Assert.AreEqual ("None1", modules [0].Name);
+ ClassicAssert.NotNull (modules);
+ ClassicAssert.AreEqual (1, modules.Count);
+ ClassicAssert.AreEqual ("None1", modules [0].Name);
List functions = modules [0].Functions.ToList ();
- Assert.AreEqual (1, functions.Count);
- Assert.AreEqual ("returns5", functions [0].Name);
- Assert.AreEqual (1, functions [0].ParameterLists.Count);
- Assert.AreEqual (0, functions [0].ParameterLists [0].Count);
- Assert.AreEqual ("Swift.Int", functions [0].ReturnTypeName);
- Assert.AreEqual (Accessibility.Public, functions [0].Access);
- Assert.AreEqual (false, functions [0].IsStatic);
- Assert.AreEqual (false, functions [0].IsProperty);
- Assert.AreEqual (false, functions [0].IsFinal);
- Assert.AreEqual ("None1.returns5", functions [0].ToFullyQualifiedName (true));
- Assert.AreEqual ("returns5", functions [0].ToFullyQualifiedName (false));
+ ClassicAssert.AreEqual (1, functions.Count);
+ ClassicAssert.AreEqual ("returns5", functions [0].Name);
+ ClassicAssert.AreEqual (1, functions [0].ParameterLists.Count);
+ ClassicAssert.AreEqual (0, functions [0].ParameterLists [0].Count);
+ ClassicAssert.AreEqual ("Swift.Int", functions [0].ReturnTypeName);
+ ClassicAssert.AreEqual (Accessibility.Public, functions [0].Access);
+ ClassicAssert.AreEqual (false, functions [0].IsStatic);
+ ClassicAssert.AreEqual (false, functions [0].IsProperty);
+ ClassicAssert.AreEqual (false, functions [0].IsFinal);
+ ClassicAssert.AreEqual ("None1.returns5", functions [0].ToFullyQualifiedName (true));
+ ClassicAssert.AreEqual ("returns5", functions [0].ToFullyQualifiedName (false));
}
@@ -63,22 +64,22 @@ public void SingleFunctionThrowsInModule ()
" " +
"";
List modules = Reflector.FromXml (xmlText, typeDatabase: null);
- Assert.NotNull (modules);
- Assert.AreEqual (1, modules.Count);
- Assert.AreEqual ("None1", modules [0].Name);
+ ClassicAssert.NotNull (modules);
+ ClassicAssert.AreEqual (1, modules.Count);
+ ClassicAssert.AreEqual ("None1", modules [0].Name);
List functions = modules [0].Functions.ToList ();
- Assert.AreEqual (1, functions.Count);
- Assert.AreEqual ("returns5", functions [0].Name);
- Assert.AreEqual (1, functions [0].ParameterLists.Count);
- Assert.AreEqual (0, functions [0].ParameterLists [0].Count);
- Assert.AreEqual ("Swift.Int", functions [0].ReturnTypeName);
- Assert.AreEqual (Accessibility.Public, functions [0].Access);
- Assert.AreEqual (false, functions [0].IsStatic);
- Assert.AreEqual (false, functions [0].IsProperty);
- Assert.AreEqual (false, functions [0].IsFinal);
- Assert.AreEqual ("None1.returns5", functions [0].ToFullyQualifiedName (true));
- Assert.AreEqual (true, functions [0].HasThrows);
- Assert.AreEqual ("returns5", functions [0].ToFullyQualifiedName (false));
+ ClassicAssert.AreEqual (1, functions.Count);
+ ClassicAssert.AreEqual ("returns5", functions [0].Name);
+ ClassicAssert.AreEqual (1, functions [0].ParameterLists.Count);
+ ClassicAssert.AreEqual (0, functions [0].ParameterLists [0].Count);
+ ClassicAssert.AreEqual ("Swift.Int", functions [0].ReturnTypeName);
+ ClassicAssert.AreEqual (Accessibility.Public, functions [0].Access);
+ ClassicAssert.AreEqual (false, functions [0].IsStatic);
+ ClassicAssert.AreEqual (false, functions [0].IsProperty);
+ ClassicAssert.AreEqual (false, functions [0].IsFinal);
+ ClassicAssert.AreEqual ("None1.returns5", functions [0].ToFullyQualifiedName (true));
+ ClassicAssert.AreEqual (true, functions [0].HasThrows);
+ ClassicAssert.AreEqual ("returns5", functions [0].ToFullyQualifiedName (false));
}
@@ -99,19 +100,19 @@ public void SinglePrivateFunctionInModule ()
" " +
"";
List modules = Reflector.FromXml (xmlText, typeDatabase: null);
- Assert.NotNull (modules);
- Assert.AreEqual (1, modules.Count);
- Assert.AreEqual ("None1", modules [0].Name);
+ ClassicAssert.NotNull (modules);
+ ClassicAssert.AreEqual (1, modules.Count);
+ ClassicAssert.AreEqual ("None1", modules [0].Name);
List functions = modules [0].Functions.ToList ();
- Assert.AreEqual (1, functions.Count);
- Assert.AreEqual ("returns5", functions [0].Name);
- Assert.AreEqual (1, functions [0].ParameterLists.Count);
- Assert.AreEqual (0, functions [0].ParameterLists [0].Count);
- Assert.AreEqual ("Swift.Int", functions [0].ReturnTypeName);
- Assert.AreEqual (Accessibility.Private, functions [0].Access);
- Assert.AreEqual (false, functions [0].IsStatic);
- Assert.AreEqual (false, functions [0].IsProperty);
- Assert.AreEqual (false, functions [0].IsFinal);
+ ClassicAssert.AreEqual (1, functions.Count);
+ ClassicAssert.AreEqual ("returns5", functions [0].Name);
+ ClassicAssert.AreEqual (1, functions [0].ParameterLists.Count);
+ ClassicAssert.AreEqual (0, functions [0].ParameterLists [0].Count);
+ ClassicAssert.AreEqual ("Swift.Int", functions [0].ReturnTypeName);
+ ClassicAssert.AreEqual (Accessibility.Private, functions [0].Access);
+ ClassicAssert.AreEqual (false, functions [0].IsStatic);
+ ClassicAssert.AreEqual (false, functions [0].IsProperty);
+ ClassicAssert.AreEqual (false, functions [0].IsFinal);
}
@@ -132,19 +133,19 @@ public void SingleInternalFunctionInModule ()
" " +
"";
List modules = Reflector.FromXml (xmlText, typeDatabase: null);
- Assert.NotNull (modules);
- Assert.AreEqual (1, modules.Count);
- Assert.AreEqual ("None1", modules [0].Name);
+ ClassicAssert.NotNull (modules);
+ ClassicAssert.AreEqual (1, modules.Count);
+ ClassicAssert.AreEqual ("None1", modules [0].Name);
List functions = modules [0].Functions.ToList ();
- Assert.AreEqual (1, functions.Count);
- Assert.AreEqual ("returns5", functions [0].Name);
- Assert.AreEqual (1, functions [0].ParameterLists.Count);
- Assert.AreEqual (0, functions [0].ParameterLists [0].Count);
- Assert.AreEqual ("Swift.Int", functions [0].ReturnTypeName);
- Assert.AreEqual (Accessibility.Internal, functions [0].Access);
- Assert.AreEqual (false, functions [0].IsStatic);
- Assert.AreEqual (false, functions [0].IsProperty);
- Assert.AreEqual (false, functions [0].IsFinal);
+ ClassicAssert.AreEqual (1, functions.Count);
+ ClassicAssert.AreEqual ("returns5", functions [0].Name);
+ ClassicAssert.AreEqual (1, functions [0].ParameterLists.Count);
+ ClassicAssert.AreEqual (0, functions [0].ParameterLists [0].Count);
+ ClassicAssert.AreEqual ("Swift.Int", functions [0].ReturnTypeName);
+ ClassicAssert.AreEqual (Accessibility.Internal, functions [0].Access);
+ ClassicAssert.AreEqual (false, functions [0].IsStatic);
+ ClassicAssert.AreEqual (false, functions [0].IsProperty);
+ ClassicAssert.AreEqual (false, functions [0].IsFinal);
}
[Test]
@@ -159,16 +160,16 @@ public void SinglePropertyInModule ()
" " +
"";
List modules = Reflector.FromXml (xmlText, typeDatabase: null);
- Assert.NotNull (modules);
- Assert.AreEqual (1, modules.Count);
- Assert.AreEqual ("None1", modules [0].Name);
+ ClassicAssert.NotNull (modules);
+ ClassicAssert.AreEqual (1, modules.Count);
+ ClassicAssert.AreEqual ("None1", modules [0].Name);
List props = modules [0].Properties.ToList ();
- Assert.AreEqual (1, props.Count);
- Assert.AreEqual ("topLevelVar", props [0].Name);
- Assert.AreEqual ("Swift.Int", props [0].TypeName);
- Assert.AreEqual (false, props [0].IsStatic);
- Assert.AreEqual (StorageKind.Stored, props [0].Storage);
- Assert.AreEqual (Accessibility.Public, props [0].Access);
+ ClassicAssert.AreEqual (1, props.Count);
+ ClassicAssert.AreEqual ("topLevelVar", props [0].Name);
+ ClassicAssert.AreEqual ("Swift.Int", props [0].TypeName);
+ ClassicAssert.AreEqual (false, props [0].IsStatic);
+ ClassicAssert.AreEqual (StorageKind.Stored, props [0].Storage);
+ ClassicAssert.AreEqual (Accessibility.Public, props [0].Access);
}
[Test]
@@ -183,16 +184,16 @@ public void SinglePrivatePropertyInModule ()
" " +
"";
List modules = Reflector.FromXml (xmlText, typeDatabase: null);
- Assert.NotNull (modules);
- Assert.AreEqual (1, modules.Count);
- Assert.AreEqual ("None1", modules [0].Name);
+ ClassicAssert.NotNull (modules);
+ ClassicAssert.AreEqual (1, modules.Count);
+ ClassicAssert.AreEqual ("None1", modules [0].Name);
List props = modules [0].Properties.ToList ();
- Assert.AreEqual (1, props.Count);
- Assert.AreEqual ("topLevelVar", props [0].Name);
- Assert.AreEqual ("Swift.Int", props [0].TypeName);
- Assert.AreEqual (false, props [0].IsStatic);
- Assert.AreEqual (StorageKind.Stored, props [0].Storage);
- Assert.AreEqual (Accessibility.Private, props [0].Access);
+ ClassicAssert.AreEqual (1, props.Count);
+ ClassicAssert.AreEqual ("topLevelVar", props [0].Name);
+ ClassicAssert.AreEqual ("Swift.Int", props [0].TypeName);
+ ClassicAssert.AreEqual (false, props [0].IsStatic);
+ ClassicAssert.AreEqual (StorageKind.Stored, props [0].Storage);
+ ClassicAssert.AreEqual (Accessibility.Private, props [0].Access);
}
[Test]
public void SingleInternalPropertyInModule ()
@@ -206,16 +207,16 @@ public void SingleInternalPropertyInModule ()
" " +
"";
List modules = Reflector.FromXml (xmlText, typeDatabase: null);
- Assert.NotNull (modules);
- Assert.AreEqual (1, modules.Count);
- Assert.AreEqual ("None1", modules [0].Name);
+ ClassicAssert.NotNull (modules);
+ ClassicAssert.AreEqual (1, modules.Count);
+ ClassicAssert.AreEqual ("None1", modules [0].Name);
List props = modules [0].Properties.ToList ();
- Assert.AreEqual (1, props.Count);
- Assert.AreEqual ("topLevelVar", props [0].Name);
- Assert.AreEqual ("Swift.Int", props [0].TypeName);
- Assert.AreEqual (false, props [0].IsStatic);
- Assert.AreEqual (StorageKind.Stored, props [0].Storage);
- Assert.AreEqual (Accessibility.Internal, props [0].Access);
+ ClassicAssert.AreEqual (1, props.Count);
+ ClassicAssert.AreEqual ("topLevelVar", props [0].Name);
+ ClassicAssert.AreEqual ("Swift.Int", props [0].TypeName);
+ ClassicAssert.AreEqual (false, props [0].IsStatic);
+ ClassicAssert.AreEqual (StorageKind.Stored, props [0].Storage);
+ ClassicAssert.AreEqual (Accessibility.Internal, props [0].Access);
}
[Test]
@@ -249,19 +250,19 @@ public void SingleClassInModule ()
" " +
" ";
List modules = Reflector.FromXml (xmlText, typeDatabase: null);
- Assert.NotNull (modules);
- Assert.AreEqual (1, modules.Count);
- Assert.AreEqual ("None1", modules [0].Name);
+ ClassicAssert.NotNull (modules);
+ ClassicAssert.AreEqual (1, modules.Count);
+ ClassicAssert.AreEqual ("None1", modules [0].Name);
List classes = modules [0].Classes.ToList ();
- Assert.AreEqual (1, classes.Count);
- Assert.AreEqual ("Foo", classes [0].Name);
- Assert.AreEqual (2, classes [0].Members.Count);
- Assert.AreEqual (0, classes [0].InnerClasses.Count);
- Assert.AreEqual (0, classes [0].InnerStructs.Count);
- Assert.AreEqual (TypeKind.Class, classes [0].Kind);
- Assert.AreEqual (Accessibility.Public, classes [0].Access);
- Assert.AreEqual ("None1.Foo", classes [0].ToFullyQualifiedName (true));
- Assert.AreEqual ("Foo", classes [0].ToFullyQualifiedName (false));
+ ClassicAssert.AreEqual (1, classes.Count);
+ ClassicAssert.AreEqual ("Foo", classes [0].Name);
+ ClassicAssert.AreEqual (2, classes [0].Members.Count);
+ ClassicAssert.AreEqual (0, classes [0].InnerClasses.Count);
+ ClassicAssert.AreEqual (0, classes [0].InnerStructs.Count);
+ ClassicAssert.AreEqual (TypeKind.Class, classes [0].Kind);
+ ClassicAssert.AreEqual (Accessibility.Public, classes [0].Access);
+ ClassicAssert.AreEqual ("None1.Foo", classes [0].ToFullyQualifiedName (true));
+ ClassicAssert.AreEqual ("Foo", classes [0].ToFullyQualifiedName (false));
}
[Test]
@@ -295,17 +296,17 @@ public void SinglePrivateClassInModule ()
" " +
" ";
List modules = Reflector.FromXml (xmlText, typeDatabase: null);
- Assert.NotNull (modules);
- Assert.AreEqual (1, modules.Count);
- Assert.AreEqual ("None1", modules [0].Name);
+ ClassicAssert.NotNull (modules);
+ ClassicAssert.AreEqual (1, modules.Count);
+ ClassicAssert.AreEqual ("None1", modules [0].Name);
List classes = modules [0].Classes.ToList ();
- Assert.AreEqual (1, classes.Count);
- Assert.AreEqual ("Foo", classes [0].Name);
- Assert.AreEqual (2, classes [0].Members.Count);
- Assert.AreEqual (0, classes [0].InnerClasses.Count);
- Assert.AreEqual (0, classes [0].InnerStructs.Count);
- Assert.AreEqual (TypeKind.Class, classes [0].Kind);
- Assert.AreEqual (Accessibility.Private, classes [0].Access);
+ ClassicAssert.AreEqual (1, classes.Count);
+ ClassicAssert.AreEqual ("Foo", classes [0].Name);
+ ClassicAssert.AreEqual (2, classes [0].Members.Count);
+ ClassicAssert.AreEqual (0, classes [0].InnerClasses.Count);
+ ClassicAssert.AreEqual (0, classes [0].InnerStructs.Count);
+ ClassicAssert.AreEqual (TypeKind.Class, classes [0].Kind);
+ ClassicAssert.AreEqual (Accessibility.Private, classes [0].Access);
}
[Test]
@@ -339,17 +340,17 @@ public void SingleInternalClassInModule ()
" " +
" ";
List modules = Reflector.FromXml (xmlText, typeDatabase: null);
- Assert.NotNull (modules);
- Assert.AreEqual (1, modules.Count);
- Assert.AreEqual ("None1", modules [0].Name);
+ ClassicAssert.NotNull (modules);
+ ClassicAssert.AreEqual (1, modules.Count);
+ ClassicAssert.AreEqual ("None1", modules [0].Name);
List classes = modules [0].Classes.ToList ();
- Assert.AreEqual (1, classes.Count);
- Assert.AreEqual ("Foo", classes [0].Name);
- Assert.AreEqual (2, classes [0].Members.Count);
- Assert.AreEqual (0, classes [0].InnerClasses.Count);
- Assert.AreEqual (0, classes [0].InnerStructs.Count);
- Assert.AreEqual (TypeKind.Class, classes [0].Kind);
- Assert.AreEqual (Accessibility.Internal, classes [0].Access);
+ ClassicAssert.AreEqual (1, classes.Count);
+ ClassicAssert.AreEqual ("Foo", classes [0].Name);
+ ClassicAssert.AreEqual (2, classes [0].Members.Count);
+ ClassicAssert.AreEqual (0, classes [0].InnerClasses.Count);
+ ClassicAssert.AreEqual (0, classes [0].InnerStructs.Count);
+ ClassicAssert.AreEqual (TypeKind.Class, classes [0].Kind);
+ ClassicAssert.AreEqual (Accessibility.Internal, classes [0].Access);
}
}
}
diff --git a/tests/tom-swifty-test/XmlReflectionTests/SwiftInterfaceParserTests.cs b/tests/tom-swifty-test/XmlReflectionTests/SwiftInterfaceParserTests.cs
index bec7cde8..077948f9 100644
--- a/tests/tom-swifty-test/XmlReflectionTests/SwiftInterfaceParserTests.cs
+++ b/tests/tom-swifty-test/XmlReflectionTests/SwiftInterfaceParserTests.cs
@@ -13,6 +13,7 @@
using SwiftReflector.TypeMapping;
using tomwiftytest;
using System.Text;
+using NUnit.Framework.Legacy;
namespace XmlReflectionTests {
[TestFixture]
@@ -44,7 +45,7 @@ XDocument ReflectToXDocument (string code, string moduleName, out SwiftInterface
var files = Directory.GetFiles (compiler.DirectoryPath);
var file = files.FirstOrDefault (name => name.EndsWith (".swiftinterface", StringComparison.Ordinal));
if (file == null)
- Assert.Fail ("no swiftinterface file");
+ ClassicAssert.Fail ("no swiftinterface file");
reflector = new SwiftInterfaceReflector (typeDatabase, new NoLoadLoader ());
return reflector.Reflect (file);
}
@@ -69,12 +70,12 @@ public func hello ()
var importModules = reflector.ImportModules;
if (importModules.Count == 3) {
- Assert.IsTrue (importModules.Contains ("_Concurrency"), "no _Concurrency import");
- Assert.IsTrue (importModules.Contains ("_StringProcessing"), "no _StringProcessing import");
+ ClassicAssert.IsTrue (importModules.Contains ("_Concurrency"), "no _Concurrency import");
+ ClassicAssert.IsTrue (importModules.Contains ("_StringProcessing"), "no _StringProcessing import");
} else if (importModules.Count > 3) {
- Assert.Fail ($"Expected 3 swift modules, but got {importModules.Count}: {AllImportModules (importModules)}");
+ ClassicAssert.Fail ($"Expected 3 swift modules, but got {importModules.Count}: {AllImportModules (importModules)}");
}
- Assert.IsTrue (importModules.Contains ("Swift"), "no Swift import");
+ ClassicAssert.IsTrue (importModules.Contains ("Swift"), "no Swift import");
}
static string AllImportModules (List importModules)
@@ -99,20 +100,20 @@ public func hello ()
var importModules = reflector.ImportModules;
if (importModules.Count == 4) {
- Assert.IsTrue (importModules.Contains ("_Concurrency"), "no _Concurrency import");
- Assert.IsTrue (importModules.Contains ("_StringProcessing"), "no _StringProcessing import");
+ ClassicAssert.IsTrue (importModules.Contains ("_Concurrency"), "no _Concurrency import");
+ ClassicAssert.IsTrue (importModules.Contains ("_StringProcessing"), "no _StringProcessing import");
} else if (importModules.Count > 4) {
- Assert.Fail ($"Expected 3 swift modules, but got {importModules.Count}: {AllImportModules (importModules)}");
+ ClassicAssert.Fail ($"Expected 3 swift modules, but got {importModules.Count}: {AllImportModules (importModules)}");
}
- Assert.IsTrue (importModules.Contains ("Swift"), "no Swift import");
- Assert.IsTrue (importModules.Contains ("Foundation"), "no Foundation import");
+ ClassicAssert.IsTrue (importModules.Contains ("Swift"), "no Swift import");
+ ClassicAssert.IsTrue (importModules.Contains ("Foundation"), "no Foundation import");
}
[Test]
public void TypeDatabaseHasOperators ()
{
var operators = typeDatabase.OperatorsForModule ("Swift");
- Assert.Less (0, operators.Count (), "no operators");
+ ClassicAssert.Less (0, operators.Count (), "no operators");
}
[Test]
@@ -132,18 +133,18 @@ public class Imag {
SwiftInterfaceReflector reflector;
var module = ReflectToModules (swiftCode, "SomeModule", out reflector).FirstOrDefault (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var cl = module.Classes.FirstOrDefault (c => c.Name == "Imag");
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
- Assert.AreEqual (2, cl.AllProperties ().Count, "wrong property count");
+ ClassicAssert.AreEqual (2, cl.AllProperties ().Count, "wrong property count");
var fn = cl.Members.FirstOrDefault (m => m.Name == "==") as FunctionDeclaration;
- Assert.IsNotNull (fn, "no function");
+ ClassicAssert.IsNotNull (fn, "no function");
- Assert.IsTrue (fn.IsOperator, "not an operator");
- Assert.AreEqual (OperatorType.Infix, fn.OperatorType, "wrong operator type");
+ ClassicAssert.IsTrue (fn.IsOperator, "not an operator");
+ ClassicAssert.AreEqual (OperatorType.Infix, fn.OperatorType, "wrong operator type");
}
[Test]
@@ -162,18 +163,18 @@ public class Imag {
SwiftInterfaceReflector reflector;
var module = ReflectToModules (swiftCode, "SomeModule", out reflector).FirstOrDefault (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var cl = module.Classes.FirstOrDefault (c => c.Name == "Imag");
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
- Assert.AreEqual (2, cl.AllProperties ().Count, "wrong property count");
+ ClassicAssert.AreEqual (2, cl.AllProperties ().Count, "wrong property count");
var fn = cl.Members.FirstOrDefault (m => m.Name == "*^*") as FunctionDeclaration;
- Assert.IsNotNull (fn, "no function");
+ ClassicAssert.IsNotNull (fn, "no function");
- Assert.IsTrue (fn.IsOperator, "not an operator");
- Assert.AreEqual (OperatorType.Postfix, fn.OperatorType, "wrong operator type");
+ ClassicAssert.IsTrue (fn.IsOperator, "not an operator");
+ ClassicAssert.AreEqual (OperatorType.Postfix, fn.OperatorType, "wrong operator type");
}
[Test]
@@ -190,17 +191,17 @@ public extension Int {
SwiftInterfaceReflector reflector;
var module = ReflectToModules (swiftCode, "SomeModule", out reflector).FirstOrDefault (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var ext = module.Extensions.FirstOrDefault ();
- Assert.IsNotNull (ext, "no extensions");
+ ClassicAssert.IsNotNull (ext, "no extensions");
var extType = ext.ExtensionOnTypeName;
- Assert.AreEqual ("Swift.Int", extType, "wrong type");
+ ClassicAssert.AreEqual ("Swift.Int", extType, "wrong type");
var extFunc = ext.Members [0] as FunctionDeclaration;
- Assert.IsNotNull (extFunc, "no func");
- Assert.AreEqual ("*^*", extFunc.Name, "wrong func name");
- Assert.IsTrue (extFunc.IsOperator, "not an operator");
- Assert.AreEqual (OperatorType.Postfix, extFunc.OperatorType, "wrong operator type");
+ ClassicAssert.IsNotNull (extFunc, "no func");
+ ClassicAssert.AreEqual ("*^*", extFunc.Name, "wrong func name");
+ ClassicAssert.IsTrue (extFunc.IsOperator, "not an operator");
+ ClassicAssert.AreEqual (OperatorType.Postfix, extFunc.OperatorType, "wrong operator type");
}
@@ -218,17 +219,17 @@ public extension Int {
SwiftInterfaceReflector reflector;
var module = ReflectToModules (swiftCode, "SomeModule", out reflector).FirstOrDefault (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var ext = module.Extensions.FirstOrDefault ();
- Assert.IsNotNull (ext, "no extensions");
+ ClassicAssert.IsNotNull (ext, "no extensions");
var extType = ext.ExtensionOnTypeName;
- Assert.AreEqual ("Swift.Int", extType, "wrong type");
+ ClassicAssert.AreEqual ("Swift.Int", extType, "wrong type");
var extFunc = ext.Members [0] as FunctionDeclaration;
- Assert.IsNotNull (extFunc, "no func");
- Assert.AreEqual ("*^*", extFunc.Name, "wrong func name");
- Assert.IsTrue (extFunc.IsOperator, "not an operator");
- Assert.AreEqual (OperatorType.Infix, extFunc.OperatorType, "wrong operator type");
+ ClassicAssert.IsNotNull (extFunc, "no func");
+ ClassicAssert.AreEqual ("*^*", extFunc.Name, "wrong func name");
+ ClassicAssert.IsTrue (extFunc.IsOperator, "not an operator");
+ ClassicAssert.AreEqual (OperatorType.Infix, extFunc.OperatorType, "wrong operator type");
}
[Test]
@@ -246,13 +247,13 @@ public override init () { }
SwiftInterfaceReflector reflector;
var module = ReflectToModules (swiftCode, "SomeModule", out reflector).FirstOrDefault (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var cl = module.Classes.Where (c => c.Name == "Bar").FirstOrDefault ();
- Assert.IsNotNull (cl, "no class");
- Assert.AreEqual (1, cl.Inheritance.Count, "wrong amount of inheritance");
+ ClassicAssert.IsNotNull (cl, "no class");
+ ClassicAssert.AreEqual (1, cl.Inheritance.Count, "wrong amount of inheritance");
var inh = cl.Inheritance [0];
- Assert.AreEqual (InheritanceKind.Class, inh.InheritanceKind, "wrong inheritance kind");
+ ClassicAssert.AreEqual (InheritanceKind.Class, inh.InheritanceKind, "wrong inheritance kind");
}
[Test]
@@ -272,15 +273,15 @@ public override init () { }
SwiftInterfaceReflector reflector;
var module = ReflectToModules (swiftCode, "SomeModule", out reflector).FirstOrDefault (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var cl = module.Classes.Where (c => c.Name == "Bar").FirstOrDefault ();
- Assert.IsNotNull (cl, "no class");
- Assert.AreEqual (2, cl.Inheritance.Count, "wrong amount of inheritance");
+ ClassicAssert.IsNotNull (cl, "no class");
+ ClassicAssert.AreEqual (2, cl.Inheritance.Count, "wrong amount of inheritance");
var inh = cl.Inheritance [0];
- Assert.AreEqual (InheritanceKind.Class, inh.InheritanceKind, "wrong inheritance kind from class");
+ ClassicAssert.AreEqual (InheritanceKind.Class, inh.InheritanceKind, "wrong inheritance kind from class");
inh = cl.Inheritance [1];
- Assert.AreEqual (InheritanceKind.Protocol, inh.InheritanceKind, "wrong inheritance kind from protocol");
+ ClassicAssert.AreEqual (InheritanceKind.Protocol, inh.InheritanceKind, "wrong inheritance kind from protocol");
}
[Test]
@@ -294,7 +295,7 @@ public init () { }
}
";
SwiftInterfaceReflector reflector;
- Assert.Throws (() => ReflectToModules (swiftCode, "SomeModule", out reflector));
+ ClassicAssert.Throws (() => ReflectToModules (swiftCode, "SomeModule", out reflector));
}
@@ -311,18 +312,18 @@ public override init () { }
var module = ReflectToXDocument (swiftCode, "SomeModule", out reflector);
var cl = module.Descendants ("typedeclaration").FirstOrDefault ();
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var clonlyattrs = cl.Element ("attributes");
- Assert.IsNotNull (clonlyattrs, "no attributes on class");
+ ClassicAssert.IsNotNull (clonlyattrs, "no attributes on class");
var attribute = clonlyattrs.Descendants ("attribute")
.Where (el => el.Attribute ("name").Value == "objc").FirstOrDefault ();
- Assert.IsNotNull (attribute, "no objc attribute");
+ ClassicAssert.IsNotNull (attribute, "no objc attribute");
var initializer = cl.Descendants ("func")
.Where (el => el.Attribute ("name").Value == ".ctor").FirstOrDefault ();
- Assert.IsNotNull (initializer, "no initializer");
+ ClassicAssert.IsNotNull (initializer, "no initializer");
attribute = initializer.Descendants ("attribute")
.Where (el => el.Attribute ("name").Value == "objc").FirstOrDefault ();
- Assert.IsNotNull (attribute, "no function attribute");
+ ClassicAssert.IsNotNull (attribute, "no function attribute");
}
[Test]
@@ -337,15 +338,15 @@ public override init () { }
";
SwiftInterfaceReflector reflector;
var module = ReflectToModules (swiftCode, "SomeModule", out reflector).FirstOrDefault (mod => mod.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var cl = module.Classes.FirstOrDefault (c => c.Name == "Foo");
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
- Assert.AreEqual (2, cl.Attributes.Count, "wrong number of attributes");
+ ClassicAssert.AreEqual (2, cl.Attributes.Count, "wrong number of attributes");
var attr = cl.Attributes.FirstOrDefault (at => at.Name == "objc");
- Assert.IsNotNull (attr, "no objc attribute");
+ ClassicAssert.IsNotNull (attr, "no objc attribute");
}
@@ -365,21 +366,21 @@ public func DoSomething () -> Int {
";
SwiftInterfaceReflector reflector;
var module = ReflectToModules (swiftCode, "SomeModule", out reflector).FirstOrDefault (mod => mod.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var cl = module.Classes.FirstOrDefault (c => c.Name == "Foo");
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var method = cl.Members.OfType ().FirstOrDefault (fn => fn.Name == "DoSomething");
- Assert.IsNotNull (method, "no method");
+ ClassicAssert.IsNotNull (method, "no method");
- Assert.AreEqual (1, method.Attributes.Count, "wrong number of attributes");
+ ClassicAssert.AreEqual (1, method.Attributes.Count, "wrong number of attributes");
var attr = method.Attributes.FirstOrDefault (at => at.Name == "objc");
- Assert.IsNotNull (attr, "no objc attribute");
+ ClassicAssert.IsNotNull (attr, "no objc attribute");
var attrParam = attr.Parameters [0] as AttributeParameterLabel;
- Assert.IsNotNull (attrParam, "not a label");
- Assert.AreEqual (attrParam.Label, "narwhal", "wrong label");
+ ClassicAssert.IsNotNull (attrParam, "not a label");
+ ClassicAssert.AreEqual (attrParam.Label, "narwhal", "wrong label");
}
[Test]
@@ -399,27 +400,27 @@ public func DoSomething () -> Int {
";
SwiftInterfaceReflector reflector;
var module = ReflectToModules (swiftCode, "SomeModule", out reflector).FirstOrDefault (mod => mod.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var cl = module.Classes.FirstOrDefault (c => c.Name == "Foo");
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var method = cl.Members.OfType ().FirstOrDefault (fn => fn.Name == "DoSomething");
- Assert.IsNotNull (method, "no method");
+ ClassicAssert.IsNotNull (method, "no method");
- Assert.AreEqual (1, method.Attributes.Count, "wrong number of attributes");
+ ClassicAssert.AreEqual (1, method.Attributes.Count, "wrong number of attributes");
var attr = method.Attributes [0];
- Assert.AreEqual (attr.Name, "available");
- Assert.AreEqual (3, attr.Parameters.Count, "wrong number of parameters");
+ ClassicAssert.AreEqual (attr.Name, "available");
+ ClassicAssert.AreEqual (3, attr.Parameters.Count, "wrong number of parameters");
var label = attr.Parameters [0] as AttributeParameterLabel;
- Assert.IsNotNull (label, "not a label at 0");
- Assert.AreEqual ("*", label.Label, "not a star");
+ ClassicAssert.IsNotNull (label, "not a label at 0");
+ ClassicAssert.AreEqual ("*", label.Label, "not a star");
label = attr.Parameters [1] as AttributeParameterLabel;
- Assert.IsNotNull (label, "not a label at 1");
- Assert.AreEqual (",", label.Label, "not a comma");
+ ClassicAssert.IsNotNull (label, "not a label at 1");
+ ClassicAssert.AreEqual (",", label.Label, "not a comma");
label = attr.Parameters [2] as AttributeParameterLabel;
- Assert.IsNotNull (label, "not a label at 2");
- Assert.AreEqual ("unavailable", label.Label, "not unavailable");
+ ClassicAssert.IsNotNull (label, "not a label at 2");
+ ClassicAssert.AreEqual ("unavailable", label.Label, "not unavailable");
}
[Test]
@@ -438,15 +439,15 @@ public func DoSomething () -> Int {
}";
SwiftInterfaceReflector reflector;
var module = ReflectToModules (swiftCode, "SomeModule", out reflector).FirstOrDefault (mod => mod.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var cl = module.Classes.FirstOrDefault (c => c.Name == "Foo");
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var method = cl.Members.OfType ().FirstOrDefault (fn => fn.Name == "DoSomething");
- Assert.IsNotNull (method, "no method");
+ ClassicAssert.IsNotNull (method, "no method");
- Assert.AreEqual ("narwhal", method.ObjCSelector, "wrong selector");
+ ClassicAssert.AreEqual ("narwhal", method.ObjCSelector, "wrong selector");
}
[Test]
@@ -465,15 +466,15 @@ public func DoSomething () -> Int {
}";
SwiftInterfaceReflector reflector;
var module = ReflectToModules (swiftCode, "SomeModule", out reflector).FirstOrDefault (mod => mod.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var cl = module.Classes.FirstOrDefault (c => c.Name == "Foo");
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var method = cl.Members.OfType ().FirstOrDefault (fn => fn.Name == "DoSomething");
- Assert.IsNotNull (method, "no method");
+ ClassicAssert.IsNotNull (method, "no method");
- Assert.AreEqual ("DoSomething", method.ObjCSelector, "wrong selector");
+ ClassicAssert.AreEqual ("DoSomething", method.ObjCSelector, "wrong selector");
}
@@ -489,15 +490,15 @@ override public init () { }
}";
SwiftInterfaceReflector reflector;
var module = ReflectToModules (swiftCode, "SomeModule", out reflector).FirstOrDefault (mod => mod.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var cl = module.Classes.FirstOrDefault (c => c.Name == "Foo");
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var method = cl.Members.OfType ().FirstOrDefault (fn => fn.Name == ".dtor");
- Assert.IsNotNull (method, "no method");
+ ClassicAssert.IsNotNull (method, "no method");
- Assert.AreEqual ("dealloc", method.ObjCSelector, "wrong selector");
+ ClassicAssert.AreEqual ("dealloc", method.ObjCSelector, "wrong selector");
}
[Test]
@@ -516,25 +517,25 @@ public func set(at: Int) { }
";
SwiftInterfaceReflector reflector;
var module = ReflectToModules (swiftCode, "SomeModule", out reflector).FirstOrDefault (mod => mod.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var cl = module.Classes.FirstOrDefault (c => c.Name == "Foo");
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var method = cl.Members.OfType ().FirstOrDefault (fn => fn.Name == "bar");
- Assert.IsNotNull (method, "no method bar");
+ ClassicAssert.IsNotNull (method, "no method bar");
- Assert.AreEqual ("barWithA:", method.ObjCSelector, "wrong bar selector");
+ ClassicAssert.AreEqual ("barWithA:", method.ObjCSelector, "wrong bar selector");
method = cl.Members.OfType ().FirstOrDefault (fn => fn.Name == "foo");
- Assert.IsNotNull (method, "no method foo");
+ ClassicAssert.IsNotNull (method, "no method foo");
- Assert.AreEqual ("foo", method.ObjCSelector, "wrong foo selector");
+ ClassicAssert.AreEqual ("foo", method.ObjCSelector, "wrong foo selector");
method = cl.Members.OfType ().FirstOrDefault (fn => fn.Name == "set");
- Assert.IsNotNull (method, "no method set");
+ ClassicAssert.IsNotNull (method, "no method set");
- Assert.AreEqual ("setAt:", method.ObjCSelector, "wrong set selector");
+ ClassicAssert.AreEqual ("setAt:", method.ObjCSelector, "wrong set selector");
}
@@ -559,20 +560,20 @@ public subscript (index:Int) ->Int {
";
SwiftInterfaceReflector reflector;
var module = ReflectToModules (swiftCode, "SomeModule", out reflector).FirstOrDefault (mod => mod.Name == "SomeModule");
- Assert.IsNotNull (module, "no module");
+ ClassicAssert.IsNotNull (module, "no module");
var cl = module.Classes.FirstOrDefault (c => c.Name == "Foo");
- Assert.IsNotNull (cl, "no class");
+ ClassicAssert.IsNotNull (cl, "no class");
var method = cl.Members.OfType ().FirstOrDefault (fn => fn.Name == "get_subscript");
- Assert.IsNotNull (method, "no method subscript getter");
+ ClassicAssert.IsNotNull (method, "no method subscript getter");
- Assert.AreEqual ("objectAtIndexedSubscript:", method.ObjCSelector, "wrong subscript getter selector");
+ ClassicAssert.AreEqual ("objectAtIndexedSubscript:", method.ObjCSelector, "wrong subscript getter selector");
method = cl.Members.OfType ().FirstOrDefault (fn => fn.Name == "set_subscript");
- Assert.IsNotNull (method, "no method subscript setter");
+ ClassicAssert.IsNotNull (method, "no method subscript setter");
- Assert.AreEqual ("setObject:atIndexedSubscript:", method.ObjCSelector, "wrong subscript setter selector");
+ ClassicAssert.AreEqual ("setObject:atIndexedSubscript:", method.ObjCSelector, "wrong subscript setter selector");
}
@@ -585,11 +586,11 @@ public void DeprecatedFunction ()
"public func foo() { }";
SwiftInterfaceReflector reflector;
var module = ReflectToModules (code, "SomeModule", out reflector).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module");
+ ClassicAssert.IsNotNull (module, "module");
var func = module.TopLevelFunctions.FirstOrDefault (f => f.Name == "foo");
- Assert.IsNotNull (func, "func");
- Assert.IsTrue (func.IsDeprecated, "deprecated");
- Assert.IsFalse (func.IsUnavailable, "unavailable");
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.IsTrue (func.IsDeprecated, "deprecated");
+ ClassicAssert.IsFalse (func.IsUnavailable, "unavailable");
}
[Test]
@@ -600,11 +601,11 @@ public void ObsoletedFunction ()
"public func foo() { }";
SwiftInterfaceReflector reflector;
var module = ReflectToModules (code, "SomeModule", out reflector).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "module");
+ ClassicAssert.IsNotNull (module, "module");
var func = module.TopLevelFunctions.FirstOrDefault (f => f.Name == "foo");
- Assert.IsNotNull (func, "func");
- Assert.IsFalse (func.IsDeprecated, "deprecated");
- Assert.IsTrue (func.IsUnavailable, "unavilable");
+ ClassicAssert.IsNotNull (func, "func");
+ ClassicAssert.IsFalse (func.IsDeprecated, "deprecated");
+ ClassicAssert.IsTrue (func.IsUnavailable, "unavilable");
}
@@ -616,11 +617,11 @@ public void DeprecatedClass ()
"public class Foo { }";
SwiftInterfaceReflector reflector;
var module = ReflectToModules (code, "SomeModule", out reflector).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
+ ClassicAssert.IsNotNull (module, "not a module");
var cl = module.Classes.FirstOrDefault (f => f.Name == "Foo");
- Assert.IsNotNull (cl, "no class");
- Assert.IsTrue (cl.IsDeprecated, "not deprecated");
- Assert.IsFalse (cl.IsUnavailable, "available");
+ ClassicAssert.IsNotNull (cl, "no class");
+ ClassicAssert.IsTrue (cl.IsDeprecated, "not deprecated");
+ ClassicAssert.IsFalse (cl.IsUnavailable, "available");
}
[Test]
@@ -633,11 +634,11 @@ public func foo (a: Bool) -> Int? {
";
SwiftInterfaceReflector reflector;
var module = ReflectToModules (code, "SomeModule", out reflector).Find (m => m.Name == "SomeModule");
- Assert.IsNotNull (module, "not a module");
+ ClassicAssert.IsNotNull (module, "not a module");
var fn = module.TopLevelFunctions.FirstOrDefault (f => f.Name == "foo");
- Assert.IsNotNull (fn, "no function");
+ ClassicAssert.IsNotNull (fn, "no function");
var retType = fn.ReturnTypeName;
- Assert.AreEqual ("Swift.Optional