From 5cdcaf5e8edd6679f667502eec421ac4e725d4ef Mon Sep 17 00:00:00 2001 From: Christian Theune Date: Wed, 6 Jan 2016 10:03:24 +0100 Subject: [PATCH] Adapt tests to show that floats work properly. --- tests/lang/eval-okay-fromjson.nix | 6 +++++- tests/lang/eval-okay-tojson.exp | 2 +- tests/lang/eval-okay-tojson.nix | 1 + tests/lang/eval-okay-types.exp | 2 +- tests/lang/eval-okay-types.nix | 10 ++++++++++ tests/lang/eval-okay-xml.exp.xml | 3 +++ tests/lang/eval-okay-xml.nix | 2 ++ 7 files changed, 23 insertions(+), 3 deletions(-) diff --git a/tests/lang/eval-okay-fromjson.nix b/tests/lang/eval-okay-fromjson.nix index 5ed0c1c43..2a9ad0cab 100644 --- a/tests/lang/eval-okay-fromjson.nix +++ b/tests/lang/eval-okay-fromjson.nix @@ -12,7 +12,9 @@ builtins.fromJSON "Width": 100 }, "Animated" : false, - "IDs": [116, 943, 234, 38793, true ,false,null, -100] + "IDs": [116, 943, 234, 38793, true ,false,null, -100], + "Latitude": 37.7668, + "Longitude": -122.3959, } } '' @@ -28,5 +30,7 @@ builtins.fromJSON }; Animated = false; IDs = [ 116 943 234 38793 true false null (0-100) ]; + Latitude = 37.7668; + Longitude = -122.3959; }; } diff --git a/tests/lang/eval-okay-tojson.exp b/tests/lang/eval-okay-tojson.exp index e8164af2b..33588493f 100644 --- a/tests/lang/eval-okay-tojson.exp +++ b/tests/lang/eval-okay-tojson.exp @@ -1 +1 @@ -"{\"a\":123,\"b\":-456,\"c\":\"foo\",\"d\":\"foo\\n\\\"bar\\\"\",\"e\":true,\"f\":false,\"g\":[1,2,3],\"h\":[\"a\",[\"b\",{\"foo\\nbar\":{}}]],\"i\":3}" +"{\"a\":123,\"b\":-456,\"c\":\"foo\",\"d\":\"foo\\n\\\"bar\\\"\",\"e\":true,\"f\":false,\"g\":[1,2,3],\"h\":[\"a\",[\"b\",{\"foo\\nbar\":{}}]],\"i\":3,\"j\":1.44}" diff --git a/tests/lang/eval-okay-tojson.nix b/tests/lang/eval-okay-tojson.nix index 0d4e55b3d..c046ba4ae 100644 --- a/tests/lang/eval-okay-tojson.nix +++ b/tests/lang/eval-okay-tojson.nix @@ -8,4 +8,5 @@ builtins.toJSON g = [ 1 2 3 ]; h = [ "a" [ "b" { "foo\nbar" = {}; } ] ]; i = 1 + 2; + j = 1.44; } diff --git a/tests/lang/eval-okay-types.exp b/tests/lang/eval-okay-types.exp index 82487f710..9a8ea0bcb 100644 --- a/tests/lang/eval-okay-types.exp +++ b/tests/lang/eval-okay-types.exp @@ -1 +1 @@ -[ true false true false true false true false true false true false "int" "bool" "string" "null" "set" "list" "lambda" "lambda" "lambda" "lambda" ] +[ true false true false true false true false true true true true true true true true true true true false true false "int" "bool" "string" "null" "set" "list" "lambda" "lambda" "lambda" "lambda" ] diff --git a/tests/lang/eval-okay-types.nix b/tests/lang/eval-okay-types.nix index 8cb225e24..a34775f5e 100644 --- a/tests/lang/eval-okay-types.nix +++ b/tests/lang/eval-okay-types.nix @@ -8,6 +8,16 @@ with builtins; (isString [ "x" ]) (isInt (1 + 2)) (isInt { x = 123; }) + (isInt (1 / 2)) + (isInt (1 + 1)) + (isInt (1 / 2)) + (isInt (1 * 2)) + (isInt (1 - 2)) + (isFloat (1.2)) + (isFloat (1 + 1.0)) + (isFloat (1 / 2.0)) + (isFloat (1 * 2.0)) + (isFloat (1 - 2.0)) (isBool (true && false)) (isBool null) (isAttrs { x = 123; }) diff --git a/tests/lang/eval-okay-xml.exp.xml b/tests/lang/eval-okay-xml.exp.xml index f124f939e..92b75e0b8 100644 --- a/tests/lang/eval-okay-xml.exp.xml +++ b/tests/lang/eval-okay-xml.exp.xml @@ -45,5 +45,8 @@ + + + diff --git a/tests/lang/eval-okay-xml.nix b/tests/lang/eval-okay-xml.nix index b9389bfae..9ee9f8a0b 100644 --- a/tests/lang/eval-okay-xml.nix +++ b/tests/lang/eval-okay-xml.nix @@ -2,6 +2,8 @@ rec { x = 123; + y = 567.890; + a = "foo"; b = "bar";