diff options
author | zsfelfoldi <zsfelfoldi@gmail.com> | 2015-03-20 20:22:01 +0800 |
---|---|---|
committer | zsfelfoldi <zsfelfoldi@gmail.com> | 2015-03-20 20:22:01 +0800 |
commit | 8324b683b4e557e6c5c9d572d01f933b3e074185 (patch) | |
tree | 8c6a8c34d87f808c3979875642d4ca38844ad22d /Godeps/_workspace/src/github.com/robertkrimen/otto/panic_test.go | |
parent | 91f9f355b2e334214e38e1827c624cdcc23c5130 (diff) | |
download | go-tangerine-8324b683b4e557e6c5c9d572d01f933b3e074185.tar.gz go-tangerine-8324b683b4e557e6c5c9d572d01f933b3e074185.tar.zst go-tangerine-8324b683b4e557e6c5c9d572d01f933b3e074185.zip |
using robertkrimen/otto, godeps updated
Diffstat (limited to 'Godeps/_workspace/src/github.com/robertkrimen/otto/panic_test.go')
-rw-r--r-- | Godeps/_workspace/src/github.com/robertkrimen/otto/panic_test.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/robertkrimen/otto/panic_test.go b/Godeps/_workspace/src/github.com/robertkrimen/otto/panic_test.go new file mode 100644 index 000000000..06f0a64fc --- /dev/null +++ b/Godeps/_workspace/src/github.com/robertkrimen/otto/panic_test.go @@ -0,0 +1,40 @@ +package otto + +import ( + "testing" +) + +func Test_panic(t *testing.T) { + tt(t, func() { + test, _ := test() + + // Test that property.value is set to something if writable is set + // to something + test(` + var abc = []; + Object.defineProperty(abc, "0", { writable: false }); + Object.defineProperty(abc, "0", { writable: false }); + "0" in abc; + `, true) + + test(`raise: + var abc = []; + Object.defineProperty(abc, "0", { writable: false }); + Object.defineProperty(abc, "0", { value: false, writable: false }); + `, "TypeError") + + // Test that a regular expression can contain \c0410 (CYRILLIC CAPITAL LETTER A) + // without panicking + test(` + var abc = 0x0410; + var def = String.fromCharCode(abc); + new RegExp("\\c" + def).exec(def); + `, "null") + + // Test transforming a transformable regular expression without a panic + test(` + new RegExp("\\u0000"); + new RegExp("\\undefined").test("undefined"); + `, true) + }) +} |