diff options
Diffstat (limited to 'nix/yants/tests')
-rw-r--r-- | nix/yants/tests/default.nix | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/nix/yants/tests/default.nix b/nix/yants/tests/default.nix index 9a0b2403e124..0c7ec2418802 100644 --- a/nix/yants/tests/default.nix +++ b/nix/yants/tests/default.nix @@ -25,7 +25,7 @@ let }; testPrimitives = it "checks that all primitive types match" [ - (assertDoesNotThrow "unit type" (unit {})) + (assertDoesNotThrow "unit type" (unit { })) (assertDoesNotThrow "int type" (int 15)) (assertDoesNotThrow "bool type" (bool false)) (assertDoesNotThrow "float type" (float 13.37)) @@ -44,7 +44,7 @@ let # Test that structures work as planned. person = struct "person" { name = string; - age = int; + age = int; contact = option (struct { email = string; @@ -55,7 +55,7 @@ let testStruct = it "checks that structures work as intended" [ (assertDoesNotThrow "person struct" (person { name = "Brynhjulf"; - age = 42; + age = 42; contact.email = "brynhjulf@yants.nix"; })) ]; @@ -70,7 +70,8 @@ let testEnum = it "checks enum definitions and matching" [ (assertEq "enum is matched correctly" - "It is in fact red!" (colour.match "red" colourMatcher)) + "It is in fact red!" + (colour.match "red" colourMatcher)) (assertThrows "out of bounds enum fails" (colour.match "alpha" (colourMatcher // { alpha = "This should never happen"; @@ -97,7 +98,8 @@ let testSum = it "checks sum types definitions and matching" [ (assertDoesNotThrow "creature sum type" some-human) (assertEq "sum type is matched correctly" - "It's a human named Brynhjulf" (creature.match some-human { + "It's a human named Brynhjulf" + (creature.match some-human { human = v: "It's a human named ${v.name}"; pet = v: "It's not supposed to be a pet!"; }) @@ -106,7 +108,7 @@ let # Test curried function definitions func = defun [ string int string ] - (name: age: "${name} is ${toString age} years old"); + (name: age: "${name} is ${toString age} years old"); testFunctions = it "checks function definitions" [ (assertDoesNotThrow "function application" (func "Brynhjulf" 42)) @@ -144,13 +146,13 @@ let ]; in - runTestsuite "yants" [ - testPrimitives - testPoly - testStruct - testEnum - testSum - testFunctions - testTypes - testRestrict - ] +runTestsuite "yants" [ + testPrimitives + testPoly + testStruct + testEnum + testSum + testFunctions + testTypes + testRestrict +] |