git-svn-id: https://svn.tlawal.org/svn/monkey@53 f6afcba9-9ef1-4bdd-9b72-7484f5705bac
This commit is contained in:
Tijani Lawal 2022-08-19 07:49:24 +00:00
parent 7fcea2117f
commit 6f00316b43

View File

@ -168,22 +168,21 @@ func TestReturnStatements(l_test *testing.T) {
}
}
// func TestLetStatements(l_test *testing.T) {
// tests := []struct {
// input string
// expected int64
// }{
// {"let a = 5; a;", 5},
// {"let a = 5 * 5; a;", 25},
// {"let a = 5; let b = a; b", 5},
// {"let a = 5; let b = a; let c = a + b + 5", 15},
// }
func TestLetStatements(l_test *testing.T) {
tests := []struct {
input string
expected int64
}{
{"let a = 5; a;", 5},
{"let a = 5 * 5; a;", 25},
{"let a = 5; let b = a; b", 5},
{"let a = 5; let b = a; let c = a + b + 5; c;", 15},
}
// //for _, tt := range tests {
// //evaluated := test_eval(tt.input)
// //test_integer_object(l_test, evaluated, tt.expected)
// //}
// }
for _, tt := range tests {
test_integer_object(l_test, test_eval(tt.input), tt.expected)
}
}
// Helpers
func test_eval(input string) object.Object {