61 checkOutput("pkg1/Class2.html", true, 62 // Retrieve value of constant in different class. 63 "Result: <a href=\"../pkg1/Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</a>", 64 "Result: <a href=\"../pkg1/Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</a>", 65 "Result: <a href=\"../pkg1/Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</a>", 66 "Result: <a href=\"../pkg1/Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</a>", 67 "Result: <a href=\"../pkg1/Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</a>", 68 // Retrieve value of constant in different package 69 "Result: <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</a>", 70 "Result: <a href=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</a>", 71 "Result: <a href=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</a>", 72 "Result: <a href=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</a>", 73 "Result: <a href=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</a>"); 74 75 checkOutput("pkg2/package-summary.html", true, 76 // Retrieve value of constant from a package page 77 "Result: <a href=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</a>"); 78 79 checkOutput("pkg1/CustomTagUsage.html", true, 80 // Test @value tag used with custom tag. 81 "<dt><span class=\"simpleTagLabel\">Todo:</span></dt>\n" + 82 "<dd>the value of this constant is 55.</dd>"); 83 84 checkOutput(Output.ERROR, true, 85 // Test @value errors printed due to invalid use or when used with 86 // non-constant or with bad references. 87 "error: value does not refer to a constant\n" 88 + " * Result: {@value TEST_12_ERROR}", 89 "error: {@value} not allowed here\n" 90 + " * Result: {@value}", 91 "error: value does not refer to a constant\n" 92 + " * Result: {@value NULL}", 93 "error: {@value} not allowed here\n" 94 + " * Invalid (null): {@value}", 95 "error: {@value} not allowed here\n" 96 + " * Invalid (non-constant field): {@value}", 97 "error: value does not refer to a constant\n" 98 + " * Here is a bad value reference: {@value UnknownClass#unknownConstant}", 99 "error: reference not found\n" 100 + " * Here is a bad value reference: {@value UnknownClass#unknownConstant}", 101 "error: {@value} not allowed here\n" 102 + " * @todo the value of this constant is {@value}" 103 ); 104 105 checkOutput("pkg1/Class1.html", false, 106 //Base case: using @value on a constant. 107 "Result: <a href=\"../pkg1/Class1.html#TEST_12_ERROR\">\"Test 12 " 108 + "generates an error message\"</a>"); 109 110 checkForException(); 111 } 112 113 @Test() 114 void test2() { 115 javadoc("-Xdoclint:none", 116 "-d", "out2", 117 "-sourcepath", testSrc, 118 "-tag", "todo", 119 "pkg1", "pkg2"); 120 checkExit(Exit.OK); 121 checkOutput(Output.WARNING, true, 122 //Test @value warning printed when used with non-constant. 123 "warning - @value tag (which references nonConstant) " 124 + "can only be used in constants.", 125 "warning - @value tag (which references NULL) " 126 + "can only be used in constants.", 127 "warning - @value tag (which references TEST_12_ERROR) " 128 + "can only be used in constants.", 129 //Test warning printed for bad reference. 130 "warning - UnknownClass#unknownConstant (referenced by " 131 + "@value tag) is an unknown reference.", 132 //Test warning printed for invalid use of @value. 133 "warning - @value tag cannot be used here." 134 ); 135 checkForException(); 136 } 137 138 void checkForException() { 139 checkOutput(Output.STDERR, false, "DocletAbortException"); 140 } 141 } | 61 checkOutput("pkg1/Class2.html", true, 62 // Retrieve value of constant in different class. 63 "Result: <a href=\"../pkg1/Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</a>", 64 "Result: <a href=\"../pkg1/Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</a>", 65 "Result: <a href=\"../pkg1/Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</a>", 66 "Result: <a href=\"../pkg1/Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</a>", 67 "Result: <a href=\"../pkg1/Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</a>", 68 // Retrieve value of constant in different package 69 "Result: <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</a>", 70 "Result: <a href=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</a>", 71 "Result: <a href=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</a>", 72 "Result: <a href=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</a>", 73 "Result: <a href=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</a>"); 74 75 checkOutput("pkg2/package-summary.html", true, 76 // Retrieve value of constant from a package page 77 "Result: <a href=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</a>"); 78 79 checkOutput("pkg1/CustomTagUsage.html", true, 80 // Test @value tag used with custom tag. 81 "<dt><span class=\"simpleTagLabel\">Todo:</span></dt>\n" + 82 "<dd>the value of this constant is 55.</dd>"); 83 84 checkOutput(Output.OUT, true, 85 // Test @value errors printed due to invalid use or when used with 86 // non-constant or with bad references. 87 "error: value does not refer to a constant\n" 88 + " * Result: {@value TEST_12_ERROR}", 89 "error: {@value} not allowed here\n" 90 + " * Result: {@value}", 91 "error: value does not refer to a constant\n" 92 + " * Result: {@value NULL}", 93 "error: {@value} not allowed here\n" 94 + " * Invalid (null): {@value}", 95 "error: {@value} not allowed here\n" 96 + " * Invalid (non-constant field): {@value}", 97 "error: value does not refer to a constant\n" 98 + " * Here is a bad value reference: {@value UnknownClass#unknownConstant}", 99 "error: reference not found\n" 100 + " * Here is a bad value reference: {@value UnknownClass#unknownConstant}", 101 "error: {@value} not allowed here\n" 102 + " * @todo the value of this constant is {@value}" 103 ); 104 105 checkOutput("pkg1/Class1.html", false, 106 //Base case: using @value on a constant. 107 "Result: <a href=\"../pkg1/Class1.html#TEST_12_ERROR\">\"Test 12 " 108 + "generates an error message\"</a>"); 109 110 checkForException(); 111 } 112 113 @Test() 114 void test2() { 115 javadoc("-Xdoclint:none", 116 "-d", "out2", 117 "-sourcepath", testSrc, 118 "-tag", "todo", 119 "pkg1", "pkg2"); 120 checkExit(Exit.OK); 121 checkOutput(Output.OUT, true, 122 //Test @value warning printed when used with non-constant. 123 "warning - @value tag (which references nonConstant) " 124 + "can only be used in constants.", 125 "warning - @value tag (which references NULL) " 126 + "can only be used in constants.", 127 "warning - @value tag (which references TEST_12_ERROR) " 128 + "can only be used in constants." 129 // TODO: re-examine these. 130 // //Test warning printed for bad reference. 131 // "warning - UnknownClass#unknownConstant (referenced by " 132 // + "@value tag) is an unknown reference.", 133 // //Test warning printed for invalid use of @value. 134 // "warning - @value tag cannot be used here." 135 ); 136 checkForException(); 137 } 138 139 void checkForException() { 140 checkOutput(Output.STDERR, false, "DocletAbortException"); 141 } 142 } |