author | chegar |
Wed, 20 Jun 2018 16:53:56 +0100 | |
branch | http-client-branch |
changeset 56792 | 9064af483bc5 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
34721
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
1 |
/* |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
2 |
* This is the test JavaScript program used in jjs-argsTest.sh |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
3 |
*/ |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
4 |
|
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
5 |
if (typeof(arguments) == 'undefined') { |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
6 |
throw new Error("arguments expected"); |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
7 |
} |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
8 |
|
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
9 |
if (arguments.length != 2) { |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
10 |
throw new Error("2 arguments are expected here"); |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
11 |
} |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
12 |
|
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
13 |
if (arguments[0] != 'hello') { |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
14 |
throw new Error("First arg should be 'hello'"); |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
15 |
} |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
16 |
|
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
17 |
if (arguments[1] != 'world') { |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
18 |
throw new Error("Second arg should be 'world'"); |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
19 |
} |
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
20 |
|
59801fbd042e
8145750: jjs fails to run simple scripts with security manager turned on
sundar
parents:
diff
changeset
|
21 |
print("Passed"); |