3 Star 1 Fork 0

Gitee 极速下载/otto

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/robertkrimen/otto
克隆/下载
panic_test.go 1.10 KB
一键复制 编辑 原始数据 按行查看 历史
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: Array.DefineOwnProperty Object.DefineOwnProperty failed")
// 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)
})
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/otto.git
git@gitee.com:mirrors/otto.git
mirrors
otto
otto
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385