add regex tests
This commit is contained in:
parent
397d87fd11
commit
6eeb101185
@ -14792,6 +14792,35 @@ test("func(...a, b)", {
|
||||
locations: true
|
||||
});
|
||||
|
||||
test("/[a-z]/u", {
|
||||
type: "Program",
|
||||
body: [
|
||||
{
|
||||
type: "ExpressionStatement",
|
||||
expression: {
|
||||
type: "Literal",
|
||||
regex: {
|
||||
pattern: "[a-z]",
|
||||
flags: "u"
|
||||
},
|
||||
loc: {
|
||||
start: {
|
||||
line: 1,
|
||||
column: 0
|
||||
},
|
||||
end: {
|
||||
line: 1,
|
||||
column: 8
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}, {
|
||||
locations: true,
|
||||
ecmaVersion: 6
|
||||
});
|
||||
|
||||
// Harmony Invalid syntax
|
||||
|
||||
testFail("0o", "Expected number in radix 8 (1:2)", {ecmaVersion: 6});
|
||||
|
||||
@ -135,6 +135,60 @@ test("\n 42\n\n", {
|
||||
}
|
||||
});
|
||||
|
||||
test("/foobar/", {
|
||||
type: "Program",
|
||||
body: [
|
||||
{
|
||||
type: "ExpressionStatement",
|
||||
expression: {
|
||||
type: "Literal",
|
||||
value: /foobar/,
|
||||
regex: {
|
||||
pattern: "foobar",
|
||||
flags: ""
|
||||
},
|
||||
loc: {
|
||||
start: {
|
||||
line: 1,
|
||||
column: 0
|
||||
},
|
||||
end: {
|
||||
line: 1,
|
||||
column: 8
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
test("/[a-z]/g", {
|
||||
type: "Program",
|
||||
body: [
|
||||
{
|
||||
type: "ExpressionStatement",
|
||||
expression: {
|
||||
type: "Literal",
|
||||
value: /[a-z]/,
|
||||
regex: {
|
||||
pattern: "[a-z]",
|
||||
flags: "g"
|
||||
},
|
||||
loc: {
|
||||
start: {
|
||||
line: 1,
|
||||
column: 0
|
||||
},
|
||||
end: {
|
||||
line: 1,
|
||||
column: 8
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
test("(1 + 2 ) * 3", {
|
||||
type: "Program",
|
||||
body: [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user