From ef79d150714386051ec4b1b5607d42ade8b7553d Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Tue, 18 Aug 2020 12:18:51 -0400 Subject: [PATCH] Bug 564123 Remove long commented out and dead test code Change-Id: I0022463409db4de701b3ad18e1309f894d499e2a --- .../tests/ManagedBuildEnvironmentTests.java | 406 ------------- .../core/tests/ManagedBuildMacrosTests.java | 566 ------------------ 2 files changed, 972 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildEnvironmentTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildEnvironmentTests.java index 6b707506294..42e64fdaf61 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildEnvironmentTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildEnvironmentTests.java @@ -32,29 +32,14 @@ import junit.framework.TestSuite; * * */ public class ManagedBuildEnvironmentTests extends TestCase { - // final private String REQUIRED_TYPE = "cdt.managedbuild.target.testgnu.exe"; //$NON-NLS-1$ // test variable names final private String NAME_CWD = "CWD"; //$NON-NLS-1$ final private String NAME_PWD = "PWD"; //$NON-NLS-1$ - // final private String NAME_CMN = "COMMON"; //$NON-NLS-1$ - // final private String NAME_WSP = "WSP"; //$NON-NLS-1$ - // final private String NAME_PRJI = "PRJI"; //$NON-NLS-1$ - // final private String NAME_PRJL = "PRJL"; //$NON-NLS-1$ - // final private String NAME_CFGI = "CFGI"; //$NON-NLS-1$ - // final private String NAME_CFGL = "CFGL"; //$NON-NLS-1$ - // final private String NAME_CFGX = "CFGX"; //$NON-NLS-1$ - // final private String NAME_CFG = "CFG"; //$NON-NLS-1$ - // final private String NAME_REM1 = "REMTST1";//$NON-NLS-1$ - // final private String NAME_REM2 = "REMTST2";//$NON-NLS-1$ // test variable values final private String VAL_CWDPWD = "CWD_&_PWD_should not be changed"; //$NON-NLS-1$ - // final private String VAL_DUMMY1 = "/a/b/c"; //$NON-NLS-1$ - // final private String VAL_DUMMY2 = "/d/e/f"; //$NON-NLS-1$ final private String VAL_PRO_INC = "/project/inc"; //$NON-NLS-1$ final private String VAL_PRO_LIB = "/project/lib"; //$NON-NLS-1$ - // final private String LISTENER_DATA = "O1T1O1O2T2T1O1T1O2T2"; //$NON-NLS-1$ - // delimiters final private String DEL_WIN = ";"; //$NON-NLS-1$ final private String DEL_UNIX = ":"; //$NON-NLS-1$ @@ -82,16 +67,6 @@ public class ManagedBuildEnvironmentTests extends TestCase { public static Test suite() { TestSuite suite = new TestSuite(ManagedBuildEnvironmentTests.class/*.getName()*/); - // suite.addTest(new ManagedBuildEnvironmentTests("testEnvNotDef")); //$NON-NLS-1$ - // suite.addTest(new ManagedBuildEnvironmentTests("testEnvUpper")); //$NON-NLS-1$ - // suite.addTest(new ManagedBuildEnvironmentTests("testEnvAppend")); //$NON-NLS-1$ - // suite.addTest(new ManagedBuildEnvironmentTests("testEnvCWDPWD")); //$NON-NLS-1$ - // suite.addTest(new ManagedBuildEnvironmentTests("testEnvSuppliers")); //$NON-NLS-1$ - // suite.addTest(new ManagedBuildEnvironmentTests("testEnvGetPath")); //$NON-NLS-1$ - // suite.addTest(new ManagedBuildEnvironmentTests("testEnvSubscribe")); //$NON-NLS-1$ - // suite.addTest(new ManagedBuildEnvironmentTests("testEnvGetParams")); //$NON-NLS-1$ - // suite.addTest(new ManagedBuildEnvironmentTests("testEnvRemove")); //$NON-NLS-1$ - // suite.addTest(new ManagedBuildEnvironmentTests("testEnvProvider")); //$NON-NLS-1$ return suite; } @@ -102,57 +77,6 @@ public class ManagedBuildEnvironmentTests extends TestCase { super.tearDown(); } - // Checking behaviour when vars are not defined (except system) - public void testEnvNotDef() { - doInit(); - assertNotNull("System vars", envProvider.getVariables(null, true, false)); //$NON-NLS-1$ - assertNotNull("Worksp. vars", envProvider.getVariables(worksp, true, false)); //$NON-NLS-1$ - assertNotNull("Project vars", envProvider.getVariables(mproj, true, false)); //$NON-NLS-1$ - IConfiguration[] cfgs = mproj.getConfigurations(); - for (int k = 0; k < cfgs.length; k++) { - assertNotNull("Project vars[" + k + "]", //$NON-NLS-1$ //$NON-NLS-2$ - envProvider.getVariables(cfgs[k], true, false)); - } - } - - /** - * testEnvUpper - check uplevel variables - * In each context, up-level vars should be returned - */ - // public void testEnvUpper(){ - // doInit(); - // addTestVariables(); - // IBuildEnvironmentVariable[] a = envProvider.getVariables(null, true, false); - // IBuildEnvironmentVariable[] b = envProvider.getVariables(worksp, true, false); - // assertTrue(varListContainNames(a, b)); - // IBuildEnvironmentVariable[] c = envProvider.getVariables(mproj, true, false); - // assertTrue(varListContainNames(b, c)); - // - // IConfiguration[] cfgs = mproj.getConfigurations(); - // for (int k=0; k - ... - - - - - ... - - - - - */ public void rm_testEnvGetPath() { doInit(); IConfiguration[] configs = mproj.getConfigurations(); @@ -276,85 +121,6 @@ public class ManagedBuildEnvironmentTests extends TestCase { } } - // public void testEnvSubscribe(){ - // doInit(); - // IConfiguration[] configs = mproj.getConfigurations(); - // - // IConfiguration cfg = configs[0]; - // UserDefinedEnvironmentSupplier usup = getSupplier(cfg, cfg.getName()); - // assertNotNull(usup); - // try { - // - // usup.deleteVariable(NAME_CFGI,configs[0]); - // usup.deleteVariable(NAME_CFGI,configs[1]); - // usup.deleteVariable(NAME_CFG+"0",configs[0]); - // usup.deleteVariable(NAME_CFG+"1",configs[0]); - // usup.deleteVariable(NAME_CFG+"0",configs[1]); - // usup.deleteVariable(NAME_CFG+"1",configs[1]); - // usup.deleteVariable(NAME_CFGL,configs[0]); - // usup.deleteVariable(NAME_CFGL,configs[1]); - // usup.deleteVariable(NAME_PRJI,mproj); - // usup.deleteVariable(NAME_PRJL,mproj); - // usup.deleteVariable(NAME_CFGX,mproj); - // listenerResult = ""; //$NON-NLS-1$ - // - // envProvider.subscribe(listener); - // // should affect config Deb - // usup.createVariable(NAME_CFGI,VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[0]); - // assertEquals("Step 1", listenerResult, LISTENER_DATA.substring(0,2)); //$NON-NLS-1$ - // // should affect config Rel - // usup.createVariable(NAME_CFGI,VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[1]); - // assertEquals("Step 2", listenerResult, LISTENER_DATA.substring(0,4)); //$NON-NLS-1$ - // - // // should affect config Deb - // usup.createVariable(NAME_CFG+"0",VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[0]); //$NON-NLS-1$ - // assertEquals("Step 3", listenerResult, LISTENER_DATA.substring(0,6)); //$NON-NLS-1$ - // // should not affect anything - variable not in path of cfg 0 - // usup.createVariable(NAME_CFG+"1",VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[0]); //$NON-NLS-1$ - // assertEquals("Step 4", listenerResult, LISTENER_DATA.substring(0,6)); //$NON-NLS-1$ - // - // // should affect config Deb - // usup.createVariable(NAME_CFGL,VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[0]); - // assertEquals("Step 5", listenerResult, LISTENER_DATA.substring(0,8)); //$NON-NLS-1$ - // // should affect config Rel - // usup.createVariable(NAME_CFGL,VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[1]); - // assertEquals("Step 6", listenerResult, LISTENER_DATA.substring(0,10)); //$NON-NLS-1$ - // - // // should not affect anything - variable not in path of cfg 1 - // usup.createVariable(NAME_CFG+"0",VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[1]); //$NON-NLS-1$ - // assertEquals("Step 7", listenerResult, LISTENER_DATA.substring(0,10)); //$NON-NLS-1$ - // // should affect config Rel - // usup.createVariable(NAME_CFG+"1",VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[1]); //$NON-NLS-1$ - // assertEquals("Step 8", listenerResult, LISTENER_DATA.substring(0,12)); //$NON-NLS-1$ - // - // // should affect both configurations - // usup.createVariable(NAME_PRJI,VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, mproj); - // assertEquals("Step 9", listenerResult, LISTENER_DATA.substring(0,16)); //$NON-NLS-1$ - // // should affect both configurations - // usup.createVariable(NAME_PRJL,VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, mproj); - // assertEquals("Step 10", listenerResult, LISTENER_DATA); //$NON-NLS-1$ - // - // - // // should not affect anything - no changes - // usup.createVariable(NAME_PRJL,VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, mproj); - // assertEquals("Step 11", listenerResult, LISTENER_DATA); //$NON-NLS-1$ - // // should not affect anything - variable not in path - // usup.createVariable(NAME_CFGX,VAL_DUMMY2, IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, mproj); - // assertEquals("Step 12", listenerResult, LISTENER_DATA); //$NON-NLS-1$ - // - // envProvider.unsubscribe(listener); - // - // // should NOT affect anything - subscription cancelled - // usup.createVariable(NAME_PRJI,VAL_DUMMY1,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, mproj); - // usup.createVariable(NAME_CFGI,VAL_DUMMY1,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[0]); - // usup.createVariable(NAME_CFGI,VAL_DUMMY1,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[1]); - // assertEquals("Step 13", listenerResult, LISTENER_DATA); //$NON-NLS-1$ - // - // } catch (Exception e) { - // fail("Failed to create configuration vars !"); //$NON-NLS-1$ - // } - // } - /** * * @@ -387,50 +153,6 @@ public class ManagedBuildEnvironmentTests extends TestCase { } } - /** - * - * - */ - // public void testEnvRemove(){ - // doInit(); - // IEnvironmentVariableProvider env = ManagedBuildManager.getEnvironmentVariableProvider(); - // UserDefinedEnvironmentSupplier usup = null; - // - // // create vars for removal tests - // assertNotNull(usup = getSupplier(worksp, "Workspace")); //$NON-NLS-1$ - // try { - // assertNotNull(usup.createVariable(NAME_REM1, VAL_DUMMY1, IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, worksp)); - // assertNotNull(usup.createVariable(NAME_REM2, VAL_DUMMY1, IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, worksp)); - // } catch (Exception e) { fail(e.getLocalizedMessage()); } - // - // assertNotNull(usup = getSupplier(mproj, "Project")); //$NON-NLS-1$ - // try { - // assertNotNull(usup.createVariable(NAME_REM1, VAL_DUMMY2, IBuildEnvironmentVariable.ENVVAR_REMOVE, DEL_UNIX, mproj)); - // assertNotNull(usup.createVariable(NAME_REM2, VAL_DUMMY2, IBuildEnvironmentVariable.ENVVAR_APPEND, DEL_UNIX, mproj)); - // } catch (Exception e) { fail(e.getLocalizedMessage()); } - // - // IConfiguration cfg = mproj.getConfigurations()[0]; - // assertNotNull(usup = getSupplier(cfg, "Configuration 0")); //$NON-NLS-1$ - // try { - // assertNotNull(usup.createVariable(NAME_REM1, VAL_CWDPWD, IBuildEnvironmentVariable.ENVVAR_REMOVE, DEL_UNIX, cfg)); - // assertNotNull(usup.createVariable(NAME_REM2, VAL_CWDPWD, IBuildEnvironmentVariable.ENVVAR_REMOVE, DEL_UNIX, cfg)); - // } catch (Exception e) { fail(e.getLocalizedMessage()); } - // - // // Check vars presence/absence on different levels - // IBuildEnvironmentVariable a = env.getVariable(NAME_REM1, worksp, true, false); - // IBuildEnvironmentVariable b = env.getVariable(NAME_REM2, worksp, true, false); - // assertNotNull(a); - // assertNotNull(b); - // a = env.getVariable(NAME_REM1, mproj, true, false); - // b = env.getVariable(NAME_REM2, mproj, true, false); - // assertNull(a); - // assertNotNull(b); - // assertEquals(b.getValue(), VAL_DUMMY1 + DEL_UNIX + VAL_DUMMY2); - // a = env.getVariable(NAME_REM1, cfg, true, false); - // b = env.getVariable(NAME_REM2, cfg, true, false); - // assertNull(a); - // assertNull(b); - // } /** * testEnvProvider() - */ @@ -450,97 +172,8 @@ public class ManagedBuildEnvironmentTests extends TestCase { a = envProvider.getVariable(TestMacro.CFG_VAR, cfgs[1], true, false); assertNull(a); - // combination user-defined and provided variables - // UserDefinedEnvironmentSupplier usup = getSupplier(cfgs[0], cfgs[0].getName()); - // usup.createVariable(TestMacro.PRJ_VAR, VAL_DUMMY1, IBuildEnvironmentVariable.ENVVAR_PREPEND, DEL_UNIX, cfgs[0]); - // a = envProvider.getVariable(TestMacro.PRJ_VAR, cfgs[0], true, false); - // assertNotNull(a); - // assertEquals(VAL_DUMMY1+DEL_UNIX+TestMacro.PRJ_VAR+mproj.getName(), a.getValue()); } - /** - * This test is not used iun suite. It just prints variabes - */ - // public void testEnvPrint(){ - // doInit(); - // printVar("s-Var", envProvider.getVariables(null, false, false)); //$NON-NLS-1$ - // printVar("w-Var", envProvider.getVariables(worksp, false, false)); //$NON-NLS-1$ - // printVar("p-Var", envProvider.getVariables(mproj, false, false)); //$NON-NLS-1$ - // IConfiguration[] cfgs = mproj.getConfigurations(); - // for (int k=0; k - "+ e.getLocalizedMessage()); //$NON-NLS-1$ //$NON-NLS-2$ - // } - // } - // try { - // proj.build(IncrementalProjectBuilder.FULL_BUILD, null); - // } catch (Exception e) {} - // } private void doInit() { envProvider = ManagedBuildManager.getEnvironmentVariableProvider(); assertNotNull(envProvider); @@ -553,45 +186,6 @@ public class ManagedBuildEnvironmentTests extends TestCase { assertNotNull(worksp); } - /* - * Print contents of env.var array, with given header. - */ - // private void printVar(String head, IBuildEnvironmentVariable[] vars) { - // if (vars != null) { - // if (vars.length > 0) { - // for (int i=0; i < vars.length; i++) { - // System.out.println(head + "[" + i + "] " + //$NON-NLS-1$ //$NON-NLS-2$ - // vars[i].getName() + " = " + //$NON-NLS-1$ - // vars[i].getValue() + " / " + //$NON-NLS-1$ - // vars[i].getOperation() + vars[i].getDelimiter()); - // } - // } else { System.out.println(head + ": array is empty"); } //$NON-NLS-1$ - // } else { System.out.println(head + ": array is null"); } //$NON-NLS-1$ - // } - - /* - * check that ALL variables from list "a" have correspondence - * in list "b" - * empty list or null are treated as corresponding to anything - */ - // private boolean varListContainNames(IBuildEnvironmentVariable[] a, IBuildEnvironmentVariable[] b) { - // if (a == null) return true; - // else if (a.length == 0) return true; - // else if (b == null) return false; - // - // for (int i=0; i ${lst}", UNKNOWN, LISTSEP, //$NON-NLS-1$ - // IBuildMacroProvider.CONTEXT_CONFIGURATION, cfgs[0]); - // - // assertEquals(a, "EIN - ZWEI - DREI -> AAA|BBB|CCC"); //$NON-NLS-1$ - // assertEquals(b, "EIN - ZWEI - -> AAA|BBB|CCC"); //$NON-NLS-1$ - // assertEquals(c, "EIN - - -> AAA|BBB|CCC"); //$NON-NLS-1$ - // assertEquals(d, "nested L1-L2-L3-L4-L3-L2-L1"); //$NON-NLS-1$ - // assertEquals(e, " - - -> "); //$NON-NLS-1$ - // } catch (BuildMacroException e) { - // fail("Exception while resolving: " + e.getLocalizedMessage()); //$NON-NLS-1$ - // } - // } - /** * testMacroResolveExceptions() */ @@ -516,181 +198,6 @@ public class ManagedBuildMacrosTests extends TestCase { assertTrue("Exception not raised for undefined delimiter", exceptionRaised); //$NON-NLS-1$ } - /** - * testMacroResolveLoop() - */ - // public void testMacroResolveLoop() { - // doInit(); - // int ctx = IBuildMacroProvider.CONTEXT_WORKSPACE; - // Object obj = worksp; - // ms = mp.getSuppliers(ctx, obj); - // assertNotNull(ms); - // - // // check state before macros added (should be OK) - // try { - // mp.checkIntegrity(ctx, obj); - // } catch (BuildMacroException e) { - // fail("Macros integrity check is failed"); //$NON-NLS-1$ - // } - // - // // create macro which references to undefined macro - // assertTrue(addMacro("B1", IBuildMacro.VALUE_TEXT, "B1-${B2}", ctx, obj)); //$NON-NLS-1$ //$NON-NLS-2$ - // rmMacro("B2", ctx, obj); // usually it does not exist, but to be sure... //$NON-NLS-1$ - // - // // check state after macro added (should be exception) - // try { - // mp.checkIntegrity(ctx, obj); - // fail("Macros misintegrity (ref to undefined) is not detected"); //$NON-NLS-1$ - // } catch (BuildMacroException e) {} - // - // // create "dead loop" of nested macros - // assertTrue(addMacro("B2", IBuildMacro.VALUE_TEXT, "B2-${B3}", ctx, obj)); //$NON-NLS-1$ //$NON-NLS-2$ - // assertTrue(addMacro("B3", IBuildMacro.VALUE_TEXT, "B3-${B1}", ctx, obj)); //$NON-NLS-1$ //$NON-NLS-2$ - // - // // check state after macros added (should be exception) - // try { - // mp.checkIntegrity(ctx, obj); - // fail("Macros misintegrity (dead loop) is not detected"); //$NON-NLS-1$ - // } catch (BuildMacroException e) {} - // - // // remove "dead loop" of nested macros - // assertTrue(rmMacro("B1", ctx, obj)); //$NON-NLS-1$ - // assertTrue(rmMacro("B2", ctx, obj)); //$NON-NLS-1$ - // assertTrue(rmMacro("B3", ctx, obj)); //$NON-NLS-1$ - // - // // check state after macros removed (should be OK) - // try { - // mp.checkIntegrity(ctx, obj); - // } catch (BuildMacroException e) { - // fail("Macros integrity check is failed " + e.getLocalizedMessage()); //$NON-NLS-1$ - // } - // } - /** - * testMacroResolveMake() - */ - /* - public void testMacroResolveMake(){ - final String p1 = "USERNAME: "; //$NON-NLS-1$ - final String p2 = "${USERNAME} "; //$NON-NLS-1$ - final String p3 = "PATH: "; //$NON-NLS-1$ - final String p4 = "${PATH} "; //$NON-NLS-1$ - final String p5 = "HostOsName: ${HostOsName} WorkspaceDirPath: ${WorkspaceDirPath}"; //$NON-NLS-1$ - final String ein1 = p1 + p2 + p3; - final String ein2 = p4 + p5; - final String ein = ein1 + ein2; - final String aus1 = "@USERNAME "; //$NON-NLS-1$ - final String aus2 = "@PATH "; //$NON-NLS-1$ - doInit(); - // Config #0 contains "variableFormat" macro = "@=". Result: 2 first macros NOT resolved - try { - UserDefinedEnvironmentSupplier env = EnvironmentVariableProvider.fUserSupplier; - env.createVariable("PATH","",IBuildEnvironmentVariable.ENVVAR_PREPEND,null,worksp); - env.createVariable("USERNAME","",IBuildEnvironmentVariable.ENVVAR_PREPEND,null,worksp); - functionCalled = 0; - String a = mp.resolveValueToMakefileFormat(ein, UNKNOWN, LISTSEP, IBuildMacroProvider.CONTEXT_CONFIGURATION, cfgs[0]); - String b = p1 + aus1 + p3 + mp.resolveValue(ein2, UNKNOWN, LISTSEP, IBuildMacroProvider.CONTEXT_CONFIGURATION, cfgs[0]); - assertEquals(a, b); // Env var names should not be resolved but converted to Makefile format - a = mp.resolveValueToMakefileFormat(ein, UNKNOWN, LISTSEP, IBuildMacroProvider.CONTEXT_PROJECT, mproj); - assertEquals(a, b); // Project context should return the same as default configuration - } catch (BuildMacroException e) { - fail(e.getLocalizedMessage()); - } - // Config #1 does not contain "variableFormat" macro. Result: all macros resolved. - try { - String a = mp.resolveValue(ein, UNKNOWN, LISTSEP, IBuildMacroProvider.CONTEXT_CONFIGURATION, cfgs[1]); - String b = mp.resolveValueToMakefileFormat(ein, UNKNOWN, LISTSEP, IBuildMacroProvider.CONTEXT_CONFIGURATION, cfgs[1]); - assertEquals(a, b); - } catch (BuildMacroException e) { - fail(e.getLocalizedMessage()); - } - // check that "isReservedName" was not called before - assertEquals(functionCalled & RESERVED_NAME, 0); - - // Config #2 contains "...Supplier" macro. Result: PATH unresolved, USERNAME resolved. - try { - String a = mp.resolveValue(p1 + p2, UNKNOWN, LISTSEP, IBuildMacroProvider.CONTEXT_CONFIGURATION, cfgs[2]); - String b = mp.resolveValue(p5, UNKNOWN, LISTSEP, IBuildMacroProvider.CONTEXT_CONFIGURATION, cfgs[2]); - a = a + p3 + aus2 + b; // USERNAME: xxx PATH: @PATH HostOsName: xxx ... - b = mp.resolveValueToMakefileFormat(ein, UNKNOWN, LISTSEP, IBuildMacroProvider.CONTEXT_CONFIGURATION, cfgs[2]); - assertEquals(a, b); - // check that "isReservedName" has been called - assertEquals(functionCalled & RESERVED_NAME, RESERVED_NAME); - } catch (BuildMacroException e) { - fail(e.getLocalizedMessage()); - } - } - */ - - /** - * testMacroResolveCase() - */ - // public void testMacroResolveCase(){ - // doInit(); - // addVars(); - // final String winOut1 = "@CASETEST uppercase uppercase uppercase"; //$NON-NLS-1$ - // final String winOut2 = "@CASETEST @CASETEST @CASETEST @CASETEST"; //$NON-NLS-1$ - // - // final String unixOut1 = "@CASETEST capitalize lowercase upper2low"; //$NON-NLS-1$ - // final String unixOut2 = "@CASETEST @CaseTest @casetest @CaSeTeSt"; //$NON-NLS-1$ - // - // final String ein = "${CASETEST} ${CaseTest} ${casetest} ${CaSeTeSt}"; //$NON-NLS-1$ - // final int ctx = IBuildMacroProvider.CONTEXT_CONFIGURATION; - // String a=null, b=null; - // try { - // // Config #0 contains isVariableCaseSensitive = false - // a = mp.resolveValueToMakefileFormat(ein, UNKNOWN, LISTSEP, ctx, cfgs[0]); - // // Config #3 contains isVariableCaseSensitive = true - // b = mp.resolveValueToMakefileFormat(ein, UNKNOWN, LISTSEP, ctx, cfgs[3]); - // } catch (BuildMacroException e) { - // fail(e.getLocalizedMessage()); - // } - // if (windows) { - // assertEquals(a, winOut1); - // assertEquals(b, winOut2); - // } else { // linux - // assertEquals(a, unixOut1); - // assertEquals(b, unixOut2); - // } - // } - - /** - * testMacroSave() - */ - - // public void testMacroSave(){ - // final String TO_SAVE_P = "TO_SAVE_P"; //$NON-NLS-1$ - // final String TO_SAVE_W = "TO_SAVE_W"; //$NON-NLS-1$ - // doInit(); - // ms = mp.getSuppliers(IBuildMacroProvider.CONTEXT_PROJECT, mproj); - // assertNotNull(ms); - // assertTrue(addMacro(TO_SAVE_P, IBuildMacro.VALUE_TEXT, TO_SAVE_P, - // IBuildMacroProvider.CONTEXT_PROJECT, mproj)); - // ms = mp.getSuppliers(IBuildMacroProvider.CONTEXT_WORKSPACE, worksp); - // assertNotNull(ms); - // assertTrue(addMacro(TO_SAVE_W, IBuildMacro.VALUE_TEXT, TO_SAVE_W, - // IBuildMacroProvider.CONTEXT_WORKSPACE, worksp)); - // try { - // // Save the buildinfo, and then remove it, to be complete - // ManagedBuildManager.saveBuildInfo(proj, true); - // ManagedBuildManager.removeBuildInfo(proj); - // proj.close(null); - // proj.open(null); - // } catch (CoreException e) { - // fail("Failed on project close/open: " + e.getLocalizedMessage()); //$NON-NLS-1$ - // } - // ms = mp.getSuppliers(IBuildMacroProvider.CONTEXT_PROJECT, mproj); - // assertNotNull(ms); - // String[] a = printMacros(mp.getMacros(IBuildMacroProvider.CONTEXT_PROJECT, mproj, flag), TO_SAVE_P); - // String[] b1 = {TO_SAVE_P}; - // assertTrue(arrayContains(b1, a)); - // - // ms = mp.getSuppliers(IBuildMacroProvider.CONTEXT_WORKSPACE, worksp); - // assertNotNull(ms); - // a = printMacros(mp.getMacros(IBuildMacroProvider.CONTEXT_WORKSPACE, worksp, flag), TO_SAVE_W); - // String[] b2 = {TO_SAVE_W}; - // assertTrue(arrayContains(b2, a)); - // } - /* * Below are service methods */ @@ -821,7 +328,6 @@ public class ManagedBuildMacrosTests extends TestCase { assertNotNull(mp); cfgs = mproj.getConfigurations(); assertNotNull(cfgs); - windows = System.getProperty("os.name").toLowerCase().startsWith("windows"); //$NON-NLS-1$ //$NON-NLS-2$ } /** @@ -847,79 +353,7 @@ public class ManagedBuildMacrosTests extends TestCase { } return true; } - /** - * addMacro - * @param name - * @param type - * @param value - * @param context - * @param obj - * @return - */ - /*private boolean addMacro(String name, int type, String value, int context, Object obj) { - assertNotNull(ms); - for(int i=0; i