|
1 // Any copyright is dedicated to the Public Domain. |
|
2 // http://creativecommons.org/licenses/publicdomain/ |
|
3 |
|
4 // Test off-thread parsing. |
|
5 |
|
6 load(libdir + 'asserts.js'); |
|
7 |
|
8 if (workerThreadCount() === 0) |
|
9 quit(0); |
|
10 |
|
11 offThreadCompileScript('Math.sin(Math.PI/2)'); |
|
12 assertEq(runOffThreadScript(), 1); |
|
13 |
|
14 offThreadCompileScript('a string which cannot be reduced to the start symbol'); |
|
15 assertThrowsInstanceOf(runOffThreadScript, SyntaxError); |
|
16 |
|
17 offThreadCompileScript('smerg;'); |
|
18 assertThrowsInstanceOf(runOffThreadScript, ReferenceError); |
|
19 |
|
20 offThreadCompileScript('throw "blerg";'); |
|
21 assertThrowsValue(runOffThreadScript, 'blerg'); |