Merge

Fri, 05 Dec 2008 21:59:59 -0800

author
tbell
date
Fri, 05 Dec 2008 21:59:59 -0800
changeset 178
4efd44aa85ff
parent 173
4674298aaf3b
parent 177
8db0c5fd6e99
child 179
e2f8f6daee9d
child 182
47a62d8d98b4

Merge

     1.1 --- a/test/com/sun/javadoc/testSourceTab/DoubleTab/C.java	Fri Dec 05 09:52:51 2008 -0800
     1.2 +++ b/test/com/sun/javadoc/testSourceTab/DoubleTab/C.java	Fri Dec 05 21:59:59 2008 -0800
     1.3 @@ -1,4 +1,4 @@
     1.4 -/* 
     1.5 +/*
     1.6   * Copyright 2002-2004 Sun Microsystems, Inc.  All Rights Reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9 @@ -23,15 +23,15 @@
    1.10  
    1.11  /**
    1.12   * <pre>
    1.13 - * 		This source
    1.14 - * 		is indented
    1.15 - * 		with tabs.
    1.16 + * \t\tThis source
    1.17 + * \t\tis indented
    1.18 + * \t\twith tabs.
    1.19   * </pre>
    1.20   */
    1.21  public class C {
    1.22 -    
    1.23 -		//This source
    1.24 -		//is indented
    1.25 -		//with tabs.
    1.26 -    
    1.27 +
    1.28 +\t\t//This source
    1.29 +\t\t//is indented
    1.30 +\t\t//with tabs.
    1.31 +
    1.32  }
     2.1 --- a/test/com/sun/javadoc/testSourceTab/SingleTab/C.java	Fri Dec 05 09:52:51 2008 -0800
     2.2 +++ b/test/com/sun/javadoc/testSourceTab/SingleTab/C.java	Fri Dec 05 21:59:59 2008 -0800
     2.3 @@ -1,4 +1,4 @@
     2.4 -/* 
     2.5 +/*
     2.6   * Copyright 2002-2004 Sun Microsystems, Inc.  All Rights Reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9 @@ -23,15 +23,15 @@
    2.10  
    2.11  /**
    2.12   * <pre>
    2.13 - *	This source
    2.14 - * 	is indented
    2.15 - * 	with tabs.
    2.16 + *\tThis source
    2.17 + * \tis indented
    2.18 + * \twith tabs.
    2.19   * </pre>
    2.20   */
    2.21  public class C {
    2.22 -    
    2.23 -	//This source
    2.24 -	//is indented
    2.25 -	//with tabs.
    2.26 -    
    2.27 +
    2.28 +\t//This source
    2.29 +\t//is indented
    2.30 +\t//with tabs.
    2.31 +
    2.32  }
     3.1 --- a/test/com/sun/javadoc/testSourceTab/TestSourceTab.java	Fri Dec 05 09:52:51 2008 -0800
     3.2 +++ b/test/com/sun/javadoc/testSourceTab/TestSourceTab.java	Fri Dec 05 21:59:59 2008 -0800
     3.3 @@ -1,5 +1,5 @@
     3.4 -/* 
     3.5 - * Copyright 2002-2004 Sun Microsystems, Inc.  All Rights Reserved.
     3.6 +/*
     3.7 + * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
     3.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.9   *
    3.10   * This code is free software; you can redistribute it and/or modify it
    3.11 @@ -33,59 +33,102 @@
    3.12   * @run main TestSourceTab
    3.13   */
    3.14  
    3.15 +import java.io.*;
    3.16 +
    3.17  public class TestSourceTab extends JavadocTester {
    3.18 -    
    3.19 +
    3.20      private static final String BUG_ID = "4510979";
    3.21 +    private static final String TMP_SRC_DIR = "tmpSrc";
    3.22      private static final String OUTPUT_DIR1 = BUG_ID + "-tabLengthEight";
    3.23      private static final String OUTPUT_DIR2 = BUG_ID + "-tabLengthFour";
    3.24      private static final String[][] TEST = NO_TEST;
    3.25      private static final String[][] NEGATED_TEST = NO_TEST;
    3.26 -    
    3.27 +
    3.28      //Run Javadoc on a source file with that is indented with a single tab per line
    3.29      private static final String[] ARGS1 =
    3.30          new String[] {
    3.31 -            "-d", OUTPUT_DIR1, "-sourcepath", SRC_DIR,
    3.32 -            "-notimestamp", "-linksource", SRC_DIR + FS + "SingleTab" + FS + "C.java"
    3.33 +            "-d", OUTPUT_DIR1, "-sourcepath", TMP_SRC_DIR,
    3.34 +            "-notimestamp", "-linksource", TMP_SRC_DIR + FS + "SingleTab" + FS + "C.java"
    3.35          };
    3.36 -    
    3.37 +
    3.38      //Run Javadoc on a source file with that is indented with a two tab per line
    3.39      //If we double the tabs and decrease the tab length by a half, the output should
    3.40      //be the same as the one generated above.
    3.41      private static final String[] ARGS2 =
    3.42          new String[] {
    3.43 -            "-d", OUTPUT_DIR2, "-sourcepath", SRC_DIR,
    3.44 -            "-notimestamp", "-sourcetab", "4", SRC_DIR + FS + "DoubleTab" + FS + "C.java"
    3.45 +            "-d", OUTPUT_DIR2, "-sourcepath", TMP_SRC_DIR,
    3.46 +            "-notimestamp", "-sourcetab", "4", TMP_SRC_DIR + FS + "DoubleTab" + FS + "C.java"
    3.47          };
    3.48 -    
    3.49 +
    3.50      //Files to diff
    3.51      private static final String[][] FILES_TO_DIFF = {
    3.52          {OUTPUT_DIR1 + FS + "src-html" + FS + "C.html",
    3.53           OUTPUT_DIR2 + FS + "src-html" + FS + "C.html"
    3.54 -        }, 
    3.55 +        },
    3.56          {OUTPUT_DIR1 + FS + "C.html",
    3.57           OUTPUT_DIR2 + FS + "C.html"
    3.58          }
    3.59 -        
    3.60 +
    3.61      };
    3.62 -    
    3.63 +
    3.64      /**
    3.65       * The entry point of the test.
    3.66       * @param args the array of command line arguments.
    3.67       */
    3.68 -    public static void main(String[] args) {
    3.69 +    public static void main(String[] args) throws IOException {
    3.70          TestSourceTab tester = new TestSourceTab();
    3.71          run(tester, ARGS1, TEST, NEGATED_TEST);
    3.72          run(tester, ARGS2, TEST, NEGATED_TEST);
    3.73          tester.runDiffs(FILES_TO_DIFF);
    3.74      }
    3.75 -    
    3.76 +
    3.77 +    TestSourceTab() throws IOException {
    3.78 +        initTabs(new File(SRC_DIR), new File(TMP_SRC_DIR));
    3.79 +    }
    3.80 +
    3.81 +    void initTabs(File from, File to) throws IOException {
    3.82 +        for (File f: from.listFiles()) {
    3.83 +            File t = new File(to, f.getName());
    3.84 +            if (f.isDirectory()) {
    3.85 +                initTabs(f, t);
    3.86 +            } else if (f.getName().endsWith(".java")) {
    3.87 +                write(t, read(f).replace("\\t", "\t"));
    3.88 +            }
    3.89 +        }
    3.90 +    }
    3.91 +
    3.92 +    String read(File f) throws IOException {
    3.93 +        StringBuilder sb = new StringBuilder();
    3.94 +        BufferedReader in = new BufferedReader(new FileReader(f));
    3.95 +        try {
    3.96 +            String line;
    3.97 +            while ((line = in.readLine()) != null) {
    3.98 +                sb.append(line);
    3.99 +                sb.append("\n");
   3.100 +            }
   3.101 +        } finally {
   3.102 +            in.close();
   3.103 +        }
   3.104 +        return sb.toString();
   3.105 +    }
   3.106 +
   3.107 +    void write(File f, String s) throws IOException {
   3.108 +        f.getParentFile().mkdirs();
   3.109 +        Writer out = new FileWriter(f);
   3.110 +        try {
   3.111 +            out.write(s);
   3.112 +        } finally {
   3.113 +            out.close();
   3.114 +        }
   3.115 +    }
   3.116 +
   3.117      /**
   3.118       * {@inheritDoc}
   3.119       */
   3.120      public String getBugId() {
   3.121          return BUG_ID;
   3.122      }
   3.123 -    
   3.124 +
   3.125      /**
   3.126       * {@inheritDoc}
   3.127       */

mercurial