diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..54a4e61 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,37 @@ +version: '{build}' + +image: Visual Studio 2015 + +cache: + - NimBinaries + +matrix: + # We always want 32 and 64-bit compilation + fast_finish: false + +platform: + - x86 + - x64 + +# when multiple CI builds are queued, the tested commit needs to be in the last X commits cloned with "--depth X" +clone_depth: 10 + +install: + # use the newest versions documented here: https://www.appveyor.com/docs/windows-images-software/#mingw-msys-cygwin + - IF "%PLATFORM%" == "x86" SET PATH=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin;%PATH% + - IF "%PLATFORM%" == "x64" SET PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH% + + # build nim from our own branch - this to avoid the day-to-day churn and + # regressions of the fast-paced Nim development while maintaining the + # flexibility to apply patches + - curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh + - env MAKE="mingw32-make -j2" ARCH_OVERRIDE=%PLATFORM% bash build_nim.sh Nim csources dist/nimble NimBinaries + - SET PATH=%CD%\Nim\bin;%PATH% + +build_script: + - nimble install -y + +test_script: + - nimble test + +deploy: off diff --git a/.travis.yml b/.travis.yml index 150d83d..9ee1b9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ install: # build nim from our own branch - this to avoid the day-to-day churn and # regressions of the fast-paced Nim development while maintaining the # flexibility to apply patches - - curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus/devel/build_nim.sh + - curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh - env MAKE="make -j2" bash build_nim.sh Nim csources dist/nimble NimBinaries - export PATH=$PWD/Nim/bin:$PATH diff --git a/serialization/object_serialization.nim b/serialization/object_serialization.nim index 882b2a1..04c8e2f 100644 --- a/serialization/object_serialization.nim +++ b/serialization/object_serialization.nim @@ -57,15 +57,15 @@ macro enumAllSerializedFieldsImpl(T: type, body: untyped): untyped = ## * `FieldType` ## Type alias for the field type ## - ## * `fieldCaseDisciminator` + ## * `fieldCaseDiscriminator` ## String literal denoting the name of the case object - ## discrimator under which the visited field is nested. + ## discriminator under which the visited field is nested. ## If the field is not nested in a specific case branch, ## this will be an empty string. ## ## * `fieldCaseBranches` ## A set literal node denoting the possible values of the - ## case object discrimator which make this field accessible. + ## case object discriminator which make this field accessible. ## ## The order of visited fields matches the order of the fields in ## the object definition unless `serialziedFields` is used to specify @@ -92,7 +92,7 @@ macro enumAllSerializedFieldsImpl(T: type, body: untyped): untyped = fieldType = field.typ fieldIdent = field.name fieldName = newLit($fieldIdent) - discrimator = newLit(if field.caseField == nil: "" + discriminator = newLit(if field.caseField == nil: "" else: $field.caseField[0]) branches = field.caseBranch fieldIndex = newLit(i) @@ -116,7 +116,7 @@ macro enumAllSerializedFieldsImpl(T: type, body: untyped): untyped = result.add quote do: block: `fieldNameVarTemplate` - template fieldCaseDisciminator: auto = `discrimator` + template fieldCaseDiscriminator: auto = `discriminator` template fieldCaseBranches: auto = `branches` # type `fieldTypeVar` = `fieldType` @@ -136,7 +136,7 @@ template enumAllSerializedFields*(T: type, body): untyped = func isCaseObject*(T: type): bool {.compileTime.} = genExpr: enumAllSerializedFields(T): - if fieldCaseDisciminator != "": + if fieldCaseDiscriminator != "": return newLit(true) newLit(false) @@ -273,7 +273,7 @@ macro setSerializedFields*(T: typedesc, fields: varargs[untyped]): untyped = const fieldNameVar = fieldName type fieldTypeVar = type(default(typ).field) - template fieldCaseDisciminator: auto = "" + template fieldCaseDiscriminator: auto = "" template fieldCaseBranches: auto = nil body diff --git a/tests/test_object_serialization.nim b/tests/test_object_serialization.nim index bc6e880..49bd6eb 100644 --- a/tests/test_object_serialization.nim +++ b/tests/test_object_serialization.nim @@ -10,7 +10,7 @@ suite "object serialization": test "custom fields order": enumAllSerializedFields(Simple): - fieldsList.add(name(FieldType) & " " & fieldName & fieldCaseDisciminator) + fieldsList.add(name(FieldType) & " " & fieldName & fieldCaseDiscriminator) check fieldsList == @["Meter distance", "int x", "string y"]