Skip to content

Commit

Permalink
make compile tests green
Browse files Browse the repository at this point in the history
  • Loading branch information
glycerine committed Dec 27, 2018
1 parent 65375f2 commit db87a99
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/compile/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import (
// TestSerialization verifies that a serialized program can be loaded,
// deserialized, and executed.
func TestSerialization(t *testing.T) {
predeclared := starlark.StringDict{
predeclared := &starlark.StringDict{Map: map[string]starlark.Value{
"x": starlark.String("mur"),
"n": starlark.MakeInt(2),
},
Immut: map[string]bool{},
}
const src = `
def mul(a, b):
Expand Down Expand Up @@ -41,13 +43,13 @@ y = mul(x, n)
if err != nil {
t.Fatalf("newProg.Init: %v", err)
}
if got, want := globals["y"], starlark.String("murmur"); got != want {
if got, want := globals.Map["y"], starlark.String("murmur"); got != want {
t.Errorf("Value of global was %s, want %s", got, want)
t.Logf("globals: %v", globals)
}

// Verify stack frame.
predeclared["n"] = starlark.None
predeclared.Map["n"] = starlark.None
_, err = newProg.Init(thread, predeclared)
evalErr, ok := err.(*starlark.EvalError)
if !ok {
Expand Down

0 comments on commit db87a99

Please sign in to comment.