Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arnav-ag committed Apr 15, 2024
1 parent 38271fb commit 5b7c9d9
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions src/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1885,3 +1885,60 @@ foo(goo);
'',
defaultNumWords
);

testProgram(
`
func sum(x int, y int) int {
return x + y
}
func partialSum(x int) func(int) int {
return func(y int) int {
return sum(x, y)
}
}
var i int = partialSum(1)(2)
`,
3,
'',
defaultNumWords
);

testProgram(
`
func sum(x int, y int) int {
return x + y
}
func partialSum(x int) func(int) int {
return func(y int) int {
return sum(x, y)
}
}
var i int = partialSum(1)(2)
var j int = partialSum(3)(4)
i + j
`,
10,
'',
defaultNumWords
);

testProgram(
`
func sum(x int, y int) int {
return x + y
}
func partialSum(x int) func(int) int {
return func(y int) int {
return sum(x, y)
}
}
var i func(int) int = partialSum(10)
var j int = i(2)
`,
12,
'',
defaultNumWords
);

0 comments on commit 5b7c9d9

Please sign in to comment.