1 /* |
1 /* |
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
53 "Method in C7.", |
53 "Method in C7.", |
54 "Method in C8.", |
54 "Method in C8.", |
55 }; |
55 }; |
56 |
56 |
57 private static final String[][] TEST3 = { |
57 private static final String[][] TEST3 = { |
58 {BUG_ID + "-3" + FS + "class-use" + FS + "UsedInC.html", "Uses of <a href=" + |
58 {BUG_ID + "-3/class-use/UsedInC.html", "Uses of <a href=" + |
59 "\"../UsedInC.html\" title=\"class in <Unnamed>\">" + |
59 "\"../UsedInC.html\" title=\"class in <Unnamed>\">" + |
60 "UsedInC</a> in <a href=\"../package-summary.html\"><Unnamed></a>" |
60 "UsedInC</a> in <a href=\"../package-summary.html\"><Unnamed></a>" |
61 }, |
61 }, |
62 {BUG_ID + "-3" + FS + "package-use.html", "<td class=\"colOne\">" + |
62 {BUG_ID + "-3/package-use.html", "<td class=\"colOne\">" + |
63 "<a href=\"class-use/UsedInC.html#%3CUnnamed%3E\">UsedInC</a> </td>" |
63 "<a href=\"class-use/UsedInC.html#%3CUnnamed%3E\">UsedInC</a> </td>" |
64 } |
64 } |
65 }; |
65 }; |
66 |
66 |
67 private static final String[][] TEST4 = { |
67 private static final String[][] TEST4 = { |
68 {BUG_ID + "-4" + FS + "pkg2" + FS + "class-use" + FS + "C3.html", "<a href=" + |
68 {BUG_ID + "-4/pkg2/class-use/C3.html", "<a href=" + |
69 "\"../../index.html?pkg2/class-use/C3.html\" target=\"_top\">" + |
69 "\"../../index.html?pkg2/class-use/C3.html\" target=\"_top\">" + |
70 "Frames</a></li>" |
70 "Frames</a></li>" |
71 } |
71 } |
72 }; |
72 }; |
73 |
73 |
78 private static final String[] ARGS2 = new String[] { |
78 private static final String[] ARGS2 = new String[] { |
79 "-d", BUG_ID+"-2", "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2" |
79 "-d", BUG_ID+"-2", "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2" |
80 }; |
80 }; |
81 |
81 |
82 private static final String[] ARGS3 = new String[] { |
82 private static final String[] ARGS3 = new String[] { |
83 "-d", BUG_ID + "-3", "-sourcepath", SRC_DIR, "-use", SRC_DIR + FS + "C.java", SRC_DIR + FS + "UsedInC.java" |
83 "-d", BUG_ID + "-3", "-sourcepath", SRC_DIR, "-use", SRC_DIR + |
|
84 "/C.java", SRC_DIR + "/UsedInC.java" |
84 }; |
85 }; |
85 |
86 |
86 private static final String[] ARGS4 = new String[] { |
87 private static final String[] ARGS4 = new String[] { |
87 "-d", BUG_ID + "-4", "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2" |
88 "-d", BUG_ID + "-4", "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2" |
88 }; |
89 }; |
93 */ |
94 */ |
94 public static void main(String[] args) throws Exception { |
95 public static void main(String[] args) throws Exception { |
95 String[][] tests = new String[11][2]; |
96 String[][] tests = new String[11][2]; |
96 //Eight tests for class use. |
97 //Eight tests for class use. |
97 for (int i = 0; i < 8; i++) { |
98 for (int i = 0; i < 8; i++) { |
98 tests[i][0] = BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html"; |
99 tests[i][0] = BUG_ID + "/pkg1/class-use/C1.html"; |
99 tests[i][1] = "Test " + (i + 1) + " passes"; |
100 tests[i][1] = "Test " + (i + 1) + " passes"; |
100 } |
101 } |
101 //Three more tests for package use. |
102 //Three more tests for package use. |
102 for (int i = 8, j = 1; i < tests.length; i++, j++) { |
103 for (int i = 8, j = 1; i < tests.length; i++, j++) { |
103 tests[i][0] = BUG_ID + FS + "pkg1" + FS + "package-use.html"; |
104 tests[i][0] = BUG_ID + "/pkg1/package-use.html"; |
104 tests[i][1] = "Test " + j + " passes"; |
105 tests[i][1] = "Test " + j + " passes"; |
105 } |
106 } |
106 TestUseOption tester = new TestUseOption(); |
107 TestUseOption tester = new TestUseOption(); |
107 run(tester, ARGS, tests, NO_TEST); |
108 run(tester, ARGS, tests, NO_TEST); |
108 tester.printSummary(); |
109 tester.printSummary(); |
109 run(tester, ARGS2, NO_TEST, NO_TEST); |
110 run(tester, ARGS2, NO_TEST, NO_TEST); |
110 String usePageContents = tester.readFileToString(BUG_ID +"-2" + FS + "pkg1" + FS + "class-use" + FS + "UsedClass.html"); |
111 String usePageContents = tester.readFileToString(BUG_ID + |
|
112 "-2/pkg1/class-use/UsedClass.html"); |
111 int prevIndex = -1; |
113 int prevIndex = -1; |
112 int currentIndex = -1; |
114 int currentIndex = -1; |
113 for (int i = 0; i < TEST2.length; i++) { |
115 for (int i = 0; i < TEST2.length; i++) { |
114 currentIndex = usePageContents.indexOf(TEST2[i]); |
116 currentIndex = usePageContents.indexOf(TEST2[i]); |
115 System.err.println(TEST2[i] + " at index " + currentIndex); |
117 System.err.println(TEST2[i] + " at index " + currentIndex); |