blob: 4b04cd06ee8316a6f3720319d1f96c08fccf5ab9 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
import junit.framework.Test;
import org.eclipse.jdt.internal.compiler.batch.Main;
public class BatchCompilerTest extends AbstractRegressionTest {
public BatchCompilerTest(String name) {
super(name);
}
public static Test suite() {
return setupSuite(testClass());
}
public void test01() {
String commandLine = "-classpath \"D:/a folder\";d:/jdk1.4/jre/lib/rt.jar -1.4 -preserveAllLocals -g -verbose d:/eclipse/workspaces/development2.0/plugins/Bar/src2/ -d d:/test";
String expected = " <-classpath> <D:/a folder;d:/jdk1.4/jre/lib/rt.jar> <-1.4> <-preserveAllLocals> <-g> <-verbose> <d:/eclipse/workspaces/development2.0/plugins/Bar/src2/> <-d> <d:/test>";
String[] args = Main.tokenize(commandLine);
StringBuffer buffer = new StringBuffer(30);
for (int i = 0; i < args.length; i++){
buffer.append(" <"+args[i]+">");
}
String result = buffer.toString();
//System.out.println(Util.displayString(result, 2));
assertEquals("incorrect tokenized command line",
expected,
result);
}
public void test02() {
String commandLine = "-classpath \"a folder\";\"b folder\"";
String expected = " <-classpath> <a folder;b folder>";
String[] args = Main.tokenize(commandLine);
StringBuffer buffer = new StringBuffer(30);
for (int i = 0; i < args.length; i++){
buffer.append(" <"+args[i]+">");
}
String result = buffer.toString();
//System.out.println(Util.displayString(result, 2));
assertEquals("incorrect tokenized command line",
expected,
result);
}
public void test03() {
String commandLine = "-classpath \"a folder;b folder\"";
String expected = " <-classpath> <a folder;b folder>";
String[] args = Main.tokenize(commandLine);
StringBuffer buffer = new StringBuffer(30);
for (int i = 0; i < args.length; i++){
buffer.append(" <"+args[i]+">");
}
String result = buffer.toString();
//System.out.println(Util.displayString(result, 2));
assertEquals("incorrect tokenized command line",
expected,
result);
}
public void test04() {
String commandLine = "\"d:/tmp A/\"A.java -classpath \"d:/tmp A\";d:/jars/rt.jar -nowarn -time -g -d d:/tmp";
String expected = " <d:/tmp A/A.java> <-classpath> <d:/tmp A;d:/jars/rt.jar> <-nowarn> <-time> <-g> <-d> <d:/tmp>";
String[] args = Main.tokenize(commandLine);
StringBuffer buffer = new StringBuffer(30);
for (int i = 0; i < args.length; i++){
buffer.append(" <"+args[i]+">");
}
String result = buffer.toString();
//System.out.println(Util.displayString(result, 2));
assertEquals("incorrect tokenized command line",
expected,
result);
}
public void test05() {
String commandLine = "\"d:/tmp A/\"A.java -classpath d:/jars/rt.jar;\"d:/tmp A\";\"toto\" -nowarn -time -g -d d:/tmp";
String expected = " <d:/tmp A/A.java> <-classpath> <d:/jars/rt.jar;d:/tmp A;toto> <-nowarn> <-time> <-g> <-d> <d:/tmp>";
String[] args = Main.tokenize(commandLine);
StringBuffer buffer = new StringBuffer(30);
for (int i = 0; i < args.length; i++){
buffer.append(" <"+args[i]+">");
}
String result = buffer.toString();
//System.out.println(Util.displayString(result, 2));
assertEquals("incorrect tokenized command line",
expected,
result);
}
public void test06() {
String commandLine = "\"d:/tmp A/A.java\" -classpath d:/jars/rt.jar;\"d:/tmp A\";d:/tmpB/ -nowarn -time -g -d d:/tmp";
String expected = " <d:/tmp A/A.java> <-classpath> <d:/jars/rt.jar;d:/tmp A;d:/tmpB/> <-nowarn> <-time> <-g> <-d> <d:/tmp>";
String[] args = Main.tokenize(commandLine);
StringBuffer buffer = new StringBuffer(30);
for (int i = 0; i < args.length; i++){
buffer.append(" <"+args[i]+">");
}
String result = buffer.toString();
//System.out.println(Util.displayString(result, 2));
assertEquals("incorrect tokenized command line",
expected,
result);
}
public static Class testClass() {
return BatchCompilerTest.class;
}
}