Skip to content

Commit

Permalink
import tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alixander committed Jul 12, 2023
1 parent af69e6f commit 5d4d9c5
Show file tree
Hide file tree
Showing 3 changed files with 824 additions and 0 deletions.
22 changes: 22 additions & 0 deletions d2ir/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,28 @@ label: meow`,
assertQuery(t, m, 0, 0, "var replaced", "q")
},
},
{
name: "vars/2",
run: func(t testing.TB) {
m, err := compileFS(t, "index.d2", map[string]string{
"index.d2": "vars: { x: 1 }; ...@a",
"a.d2": "vars: { x: 2 }; hi: ${x}",
})
assert.Success(t, err)
assertQuery(t, m, 0, 0, 2, "hi")
},
},
{
name: "vars/3",
run: func(t testing.TB) {
m, err := compileFS(t, "index.d2", map[string]string{
"index.d2": "...@a; vars: { x: 1 }; hi: ${x}",
"a.d2": "vars: { x: 2 }",
})
assert.Success(t, err)
assertQuery(t, m, 0, 0, 1, "hi")
},
},
}

runa(t, tca)
Expand Down
Loading

0 comments on commit 5d4d9c5

Please sign in to comment.