-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.js
65 lines (58 loc) · 1.61 KB
/
tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
export default [
// Reassign a constant variable
{
js: 'const x=0;x=1',
chrome: 'Assignment to constant variable.',
firefox: 'invalid assignment to const `x\'',
safari: 'Attempted to assign to readonly property.'
},
// Access a key of undefined
{
js: 'var x={};x.y.z',
chrome: 'Cannot read property \'z\' of undefined',
firefox: 'x.y is undefined',
safari: 'undefined is not an object (evaluating \'x.y.z\')'
},
// Create a var with name 'var'
{
js: 'var var=0',
chrome: 'Unexpected token var',
firefox: 'missing variable name',
safari: 'Cannot use the keyword \'var\' as a variable name.'
},
// Invalid arrow syntax
{
js: 'var x=x=>return x',
chrome: 'Unexpected token return',
firefox: 'expected expression, got keyword \'return\'',
safari: 'Unexpected keyword \'return\''
},
// JSON parse error
{
js: 'JSON.parse("{")',
chrome: 'Unexpected end of JSON input',
firefox: 'JSON.parse: end of data while reading object contents at line 1 column 2 of the JSON data',
safari: 'JSON Parse error: Expected \'}\''
},
// Invalid URL
{
js: 'new URL("")',
chrome: 'Failed to construct \'URL\': Invalid URL',
firefox: ' is not a valid URL.',
safari: 'Type error'
},
// Invoke a non-function
{
js: 'var x=0;x()',
chrome: 'x is not a function',
firefox: 'x is not a function',
safari: 'x is not a function. (In \'x()\', \'x\' is 0)'
},
// Invoke ()()
{
js: '()()',
chrome: 'Unexpected token )',
firefox: 'expected expression, got \')\'',
safari: 'Unexpected token \')\''
}
];