author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 41374 | jdk/test/tools/jjs/modulepath.js@092e014ed01e |
permissions | -rw-r--r-- |
41374
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
1 |
/* |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
2 |
* This is the test JavaScript program used in jjs-modulepathTest.sh |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
3 |
*/ |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
4 |
|
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
5 |
print("--module-path passed: " + $OPTIONS._module_path); |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
6 |
print("--add-modules passed: " + $OPTIONS._add_modules); |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
7 |
|
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
8 |
var Hello = com.greetings.Hello; |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
9 |
var moduleName = Hello.class.module.name; |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
10 |
if (moduleName != "com.greetings") { |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
11 |
throw new Error("Expected module name to be com.greetings"); |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
12 |
} else { |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
13 |
print("Module name is " + moduleName); |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
14 |
} |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
15 |
|
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
16 |
var msg = Hello.greet(); |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
17 |
if (msg != "Hello World!") { |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
18 |
throw new Error("Expected 'Hello World!'"); |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
19 |
} else { |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
20 |
print(msg); |
092e014ed01e
8167018: Nashorn and jjs should support --module-path and --add-modules options
sundar
parents:
diff
changeset
|
21 |
} |