fix wasm and tests
All checks were successful
/ test (push) Successful in 51s

This commit is contained in:
Neemek 2026-07-15 21:46:14 +02:00
parent 575fd8e37a
commit 7879184d56
Signed by: neemek
GPG key ID: 84FFE4D7D40AB25E
4 changed files with 40 additions and 59 deletions

View file

@ -37,7 +37,6 @@ func GetCompileTestData() map[string]CompileTestData {
return map[string]CompileTestData{
"constant_string": {
&Program{
[]Import{},
&BlockNode{
[]Node{
&AssignNode{
@ -50,17 +49,14 @@ func GetCompileTestData() map[string]CompileTestData {
true,
0, 0,
},
&ReferenceNode{"a", 0, 0},
},
0, 0,
},
"",
},
[]Value{&StringValue{"Hello world!"}},
[]map[string]Value{
{
"a": &StringValue{"Hello world!"},
},
},
[]map[string]Value{},
},
/* these tests are so fucking unmaintainable
"conditional_false": {
@ -626,7 +622,7 @@ func TestCompile(t *testing.T) {
c := NewCompiler([]rune(testCase.program.String()))
t.Log("Compiling node tree")
err := c.Compile(testCase.program)
_, err := c.Compile(testCase.program)
if err != nil {
t.Fatalf("Compiling failed: %v", err)
}
@ -654,7 +650,7 @@ func BenchmarkCompile(b *testing.B) {
b.Run(name, func(b *testing.B) {
for i := 0; i < b.N; i++ {
c := NewCompiler([]rune{})
_ = c.Compile(testCase.program)
_, _ = c.Compile(testCase.program)
}
})
}
@ -683,7 +679,7 @@ func TestCompiler_CleanStack(t *testing.T) {
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
c := NewCompiler([]rune(tc.program.String()))
err := c.Compile(tc.program)
_, err := c.Compile(tc.program)
if err != nil {
t.Fatalf("Compiling failed: %v", err)
}
@ -696,7 +692,7 @@ func TestCompiler_CleanStack(t *testing.T) {
for i := 1; i < int(vm.Stack.Current); i++ {
v := vm.Stack.items[i]
if v == nil || v.Type() != VariableValueType {
if v == nil {
t.Errorf("Unclean stack! value %v at %d on the stack is intermediary", v.String(), i)
}
}