test: add typed dhall

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main v0.0.1
jolheiser 2024-06-03 21:53:01 -05:00
parent 1bcb2c430f
commit 7e369588fa
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
3 changed files with 10 additions and 3 deletions

View File

@ -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)
})
}

3
testdata/typed.dhall vendored 100644
View File

@ -0,0 +1,3 @@
let Test = { s : Text, i : Natural, b : Bool, d : Text }
in { s = "s", i = 10, b = True, d = "5s" } : Test

View File

@ -1,5 +1,5 @@
{ s = [ "a", "bb" ]
, i = [ "10", "11", "12" ]
, i = [ 10, 11, 12 ]
, b = [ False, True ]
, d = [ "10m", "5s" ]
, x = [ "a", "B", "👍" ]