From 7e369588fa0068159ebac6541d2f22be0c4d66f2 Mon Sep 17 00:00:00 2001 From: jolheiser Date: Mon, 3 Jun 2024 21:53:01 -0500 Subject: [PATCH] test: add typed dhall Signed-off-by: jolheiser --- ffdhall_test.go | 8 ++++++-- testdata/typed.dhall | 3 +++ testdata/value_arrays.dhall | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 testdata/typed.dhall diff --git a/ffdhall_test.go b/ffdhall_test.go index f1dfbec..43e7541 100644 --- a/ffdhall_test.go +++ b/ffdhall_test.go @@ -1,7 +1,6 @@ package ffdhall import ( - "fmt" "testing" "time" @@ -30,6 +29,12 @@ func TestDhallParser(t *testing.T) { file: "testdata/basic.dhall", want: fftest.Vars{S: "s", I: 10, B: true, D: 5 * time.Second}, }, + { + name: "typed KV pairs", + args: []string{}, + file: "testdata/typed.dhall", + want: fftest.Vars{S: "s", I: 10, B: true, D: 5 * time.Second}, + }, { name: "value arrays", args: []string{}, @@ -49,7 +54,6 @@ func TestDhallParser(t *testing.T) { ff.WithConfigFile(testcase.file), ff.WithConfigFileParser(DhallParser), ) - fmt.Println(vars.ParseError) fftest.Compare(t, &testcase.want, vars) }) } diff --git a/testdata/typed.dhall b/testdata/typed.dhall new file mode 100644 index 0000000..b9fe64b --- /dev/null +++ b/testdata/typed.dhall @@ -0,0 +1,3 @@ +let Test = { s : Text, i : Natural, b : Bool, d : Text } + +in { s = "s", i = 10, b = True, d = "5s" } : Test diff --git a/testdata/value_arrays.dhall b/testdata/value_arrays.dhall index 496e203..2e0b106 100644 --- a/testdata/value_arrays.dhall +++ b/testdata/value_arrays.dhall @@ -1,5 +1,5 @@ { s = [ "a", "bb" ] -, i = [ "10", "11", "12" ] +, i = [ 10, 11, 12 ] , b = [ False, True ] , d = [ "10m", "5s" ] , x = [ "a", "B", "👍" ]