test/jdk/javadoc/doclet/testRelativeLinks/TestRelativeLinks.java

Print this page




  37 
  38     public static void main(String... args) throws Exception {
  39         TestRelativeLinks tester = new TestRelativeLinks();
  40         tester.runTests();
  41     }
  42 
  43     @Test
  44     void test() {
  45         javadoc("-d", "out",
  46                 "-use",
  47                 "-sourcepath", testSrc,
  48                 "pkg", "pkg2");
  49         checkExit(Exit.OK);
  50 
  51         // These relative paths should stay relative because they appear
  52         // in the right places.
  53         checkOutput("pkg/C.html", true,
  54             "<a href=\"relative-class-link.html\">relative class link</a>",
  55             "<a href=\"relative-field-link.html\">relative field link</a>",
  56             "<a href=\"relative-method-link.html\">relative method link</a>",
  57             " <a\n" +
  58             " href=\"relative-multi-line-link.html\">relative-multi-line-link</a>.");
  59         checkOutput("pkg/package-summary.html", true,
  60             "<a href=\"relative-package-link.html\">relative package link</a>");
  61 
  62         // These relative paths should be redirected because they are in different
  63         // places.
  64 
  65         // INDEX PAGE
  66         checkOutput("index-all.html", true,
  67             "<a href=\"./pkg/relative-class-link.html\">relative class link</a>",
  68             "<a href=\"./pkg/relative-field-link.html\">relative field link</a>",
  69             "<a href=\"./pkg/relative-method-link.html\">relative method link</a>",
  70             "<a href=\"./pkg/relative-package-link.html\">relative package link</a>",
  71             " <a\n" +
  72             " href=\"./pkg/relative-multi-line-link.html\">relative-multi-line-link</a>.");
  73 
  74         // PACKAGE USE
  75         checkOutput("pkg/package-use.html", true,
  76             "<a href=\"../pkg/relative-package-link.html\">relative package link</a>.",
  77             "<a href=\"../pkg/relative-class-link.html\">relative class link</a>");
  78 
  79         // CLASS_USE
  80         checkOutput("pkg/class-use/C.html", true,
  81             "<a href=\"../../pkg/relative-field-link.html\">relative field link</a>",
  82             "<a href=\"../../pkg/relative-method-link.html\">relative method link</a>",
  83             "<a href=\"../../pkg/relative-package-link.html\">relative package link</a>",
  84             " <a\n" +
  85             " href=\"../../pkg/relative-multi-line-link.html\">relative-multi-line-link</a>.");
  86 
  87         // PACKAGE OVERVIEW
  88         checkOutput("overview-summary.html", true,
  89             "<a href=\"./pkg/relative-package-link.html\">relative package link</a>");
  90     }
  91 }


  37 
  38     public static void main(String... args) throws Exception {
  39         TestRelativeLinks tester = new TestRelativeLinks();
  40         tester.runTests();
  41     }
  42 
  43     @Test
  44     void test() {
  45         javadoc("-d", "out",
  46                 "-use",
  47                 "-sourcepath", testSrc,
  48                 "pkg", "pkg2");
  49         checkExit(Exit.OK);
  50 
  51         // These relative paths should stay relative because they appear
  52         // in the right places.
  53         checkOutput("pkg/C.html", true,
  54             "<a href=\"relative-class-link.html\">relative class link</a>",
  55             "<a href=\"relative-field-link.html\">relative field link</a>",
  56             "<a href=\"relative-method-link.html\">relative method link</a>",
  57             " <a href=\"relative-multi-line-link.html\">relative-multi-line-link</a>.");

  58         checkOutput("pkg/package-summary.html", true,
  59             "<a href=\"relative-package-link.html\">relative package link</a>");
  60 
  61         // These relative paths should be redirected because they are in different
  62         // places.
  63 
  64         // INDEX PAGE
  65         checkOutput("index-all.html", true,
  66             "<a href=\"./pkg/relative-class-link.html\">relative class link</a>",
  67             "<a href=\"./pkg/relative-field-link.html\">relative field link</a>",
  68             "<a href=\"./pkg/relative-method-link.html\">relative method link</a>",
  69             "<a href=\"./pkg/relative-package-link.html\">relative package link</a>",
  70             " <a href=\"./pkg/relative-multi-line-link.html\">relative-multi-line-link</a>.",
  71             "<div class=\"block\"><a name=\"./pkg/masters\"></a>");
  72 
  73         // PACKAGE USE
  74         checkOutput("pkg/package-use.html", true,
  75             "<a href=\"../pkg/relative-package-link.html\">relative package link</a>.",
  76             "<a href=\"../pkg/relative-class-link.html\">relative class link</a>");
  77 
  78         // CLASS_USE
  79         checkOutput("pkg/class-use/C.html", true,
  80             "<a href=\"../../pkg/relative-field-link.html\">relative field link</a>",
  81             "<a href=\"../../pkg/relative-method-link.html\">relative method link</a>",
  82             "<a href=\"../../pkg/relative-package-link.html\">relative package link</a>",
  83             " <a href=\"../../pkg/relative-multi-line-link.html\">relative-multi-line-link</a>.");

  84 
  85         // PACKAGE OVERVIEW
  86         checkOutput("overview-summary.html", true,
  87             "<a href=\"./pkg/relative-package-link.html\">relative package link</a>");
  88     }
  89 }