summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/offThreadCompileScript-01.js
blob: 43620618887b4ad08e28cdd4ad06b1315ba17875 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// |jit-test| skip-if: helperThreadCount() === 0

// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/

// Test off-thread parsing.

load(libdir + 'asserts.js');

offThreadCompileScript('Math.sin(Math.PI/2)');
assertEq(runOffThreadScript(), 1);

offThreadCompileScript('a string which cannot be reduced to the start symbol');
assertThrowsInstanceOf(runOffThreadScript, SyntaxError);

offThreadCompileScript('smerg;');
assertThrowsInstanceOf(runOffThreadScript, ReferenceError);

offThreadCompileScript('throw "blerg";');
assertThrowsValue(runOffThreadScript, 'blerg');