project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/BaseTest.java
changeset 610 bfb3ab3f70f2
parent 0 fb279309251b
equal deleted inserted replaced
609:bf7dbec89c47 610:bfb3ab3f70f2
    37 import com.nokia.carbide.internal.cpp.epoc.engine.parser.ParserFactory;
    37 import com.nokia.carbide.internal.cpp.epoc.engine.parser.ParserFactory;
    38 import com.nokia.carbide.internal.cpp.epoc.engine.parser.ProblemVisitor;
    38 import com.nokia.carbide.internal.cpp.epoc.engine.parser.ProblemVisitor;
    39 import com.nokia.carbide.internal.cpp.epoc.engine.preprocessor.ASTPreprocessor;
    39 import com.nokia.carbide.internal.cpp.epoc.engine.preprocessor.ASTPreprocessor;
    40 import com.nokia.carbide.internal.cpp.epoc.engine.preprocessor.IConditionalBlock;
    40 import com.nokia.carbide.internal.cpp.epoc.engine.preprocessor.IConditionalBlock;
    41 import com.nokia.cpp.internal.api.utils.core.FileUtils;
    41 import com.nokia.cpp.internal.api.utils.core.FileUtils;
       
    42 import com.nokia.cpp.internal.api.utils.core.HostOS;
    42 import com.nokia.cpp.internal.api.utils.core.IMessage;
    43 import com.nokia.cpp.internal.api.utils.core.IMessage;
    43 import com.nokia.cpp.internal.api.utils.core.TextUtils;
    44 import com.nokia.cpp.internal.api.utils.core.TextUtils;
    44 
    45 
    45 import org.eclipse.core.resources.WorkspaceJob;
    46 import org.eclipse.core.resources.WorkspaceJob;
    46 import org.eclipse.core.runtime.CoreException;
    47 import org.eclipse.core.runtime.CoreException;
   151 	protected boolean allowParseErrors = false;
   152 	protected boolean allowParseErrors = false;
   152 
   153 
   153 	private HashMap<String, String> refMap;
   154 	private HashMap<String, String> refMap;
   154 	protected IPath modelPath;
   155 	protected IPath modelPath;
   155 	
   156 	
       
   157 	protected String getTokenAbsolutePath() {
       
   158 		return HostOS.IS_WIN32 
       
   159 			 ? "c:\\tests\\" : "/tmp/";
       
   160 	}
       
   161 	
       
   162 	protected String toDosPath(IPath path) {
       
   163 		return path.toPortableString().replaceAll("/", "\\\\");
       
   164 	}
       
   165 	protected String toDosPath(String path) {
       
   166 		return path.replaceAll("/", "\\\\");
       
   167 	}
       
   168 	
   156 	/* (non-Javadoc)
   169 	/* (non-Javadoc)
   157 	 * @see junit.framework.TestCase#setUp()
   170 	 * @see junit.framework.TestCase#setUp()
   158 	 */
   171 	 */
   159 	@Override
   172 	@Override
   160 	protected void setUp() throws Exception {
   173 	protected void setUp() throws Exception {
   161 		super.setUp();
   174 		super.setUp();
   162 		if (projectPath == null)
   175 		if (projectPath == null)
   163 			projectPath = new Path("c:/tests/project");
   176 			projectPath = new Path(getTokenAbsolutePath()).append("project");
   164 		parserConfig = new ParserConfigurationBase(projectPath) {
   177 		parserConfig = new ParserConfigurationBase(projectPath) {
   165 
   178 
   166 			@Override
   179 			@Override
   167 			protected IASTTranslationUnit parse(IPath path, IDocument document) {
   180 			protected IASTTranslationUnit parse(IPath path, IDocument document) {
   168 				return BaseTest.this.parse(path, document);
   181 				return BaseTest.this.parse(path, document);