-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy path080_error.xml
More file actions
123 lines (94 loc) · 2.45 KB
/
080_error.xml
File metadata and controls
123 lines (94 loc) · 2.45 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?xml version="1.0" encoding="utf-8" ?>
<!--
/*****************************************************************************
*
* ReoScript - .NET Script Language Engine
*
* https://github.com/unvell/ReoScript
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
* KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
* PURPOSE.
*
* This software released under MIT license.
* Copyright (c) 2012-2019 Jingwood, unvell.com, all rights reserved.
*
****************************************************************************/
-->
<test-suite id="080" name="error">
<test-case id="001" name="catch error">
<script>
var t = debug.assert;
var catched = false;
try {
undefinedfunc();
// The error above should be catched,
// or we make an assert fail if here can be reached
t( false );
} catch {
// catch error
catched = true;
}
t( catched );
</script>
</test-case>
<test-case id="002" name="throw error">
<script>
var t = debug.assert;
try {
if (true) {
throw new Error('error anyway');
}
t( false );
} catch(e) {
t( typeof e, 'object' );
t( e instanceof Error );
t( e.message, 'error anyway' );
}
</script>
</test-case>
<test-case id="003" name="finally">
<script>
var t = debug.assert;
var a = 1;
try {
throw new Error('error anyway');
t( false );
} catch(e) {
t( e.message, 'error anyway' );
} finally {
t( a, 1 );
a = 0;
}
t( a, 0 );
</script>
</test-case>
<test-case id="004" name="throw objcect">
<script>
var t = debug.assert;
try {
throw 10;
t( false );
} catch(e) {
t( e, 10 );
}
</script>
</test-case>
<test-case id="005" name="nested try catch">
<script>
var t = debug.assert;
try {
try {
throw 'inner error';
} catch(e) {
t( e, 'inner error' );
throw 'outer error';
}
t( false );
} catch(e) {
t( e, 'outer error' );
}
</script>
</test-case>
</test-suite>