diff options
Diffstat (limited to 'Godeps/_workspace/src/github.com/robertkrimen/otto/parser_test.go')
-rw-r--r-- | Godeps/_workspace/src/github.com/robertkrimen/otto/parser_test.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/parser_test.go b/Godeps/_workspace/src/github.com/robertkrimen/otto/parser_test.go new file mode 100644 index 000000000..7db43d239 --- /dev/null +++ b/Godeps/_workspace/src/github.com/robertkrimen/otto/parser_test.go @@ -0,0 +1,42 @@ +package otto + +import ( + "testing" +) + +func TestPersistence(t *testing.T) { + tt(t, func() { + test, _ := test() + + test(` + function abc() { return 1; } + abc.toString(); + `, "function abc() { return 1; }") + + test(` + function def() { return 3.14159; } + [ abc.toString(), def.toString() ]; + `, "function abc() { return 1; },function def() { return 3.14159; }") + + test(` + eval("function ghi() { return 'ghi' }"); + [ abc.toString(), def.toString(), ghi.toString() ]; + `, "function abc() { return 1; },function def() { return 3.14159; },function ghi() { return 'ghi' }") + + test(` + [ abc.toString(), def.toString(), ghi.toString() ]; + `, "function abc() { return 1; },function def() { return 3.14159; },function ghi() { return 'ghi' }") + + test(`/* + + + + + + + + + + */`, UndefinedValue()) + }) +} |