- for(int i=0;i<testParts.length;i+=2) {
- String input = testParts[i];
- String expectedOutput = testParts[i+1];
- String actualOutput = test(testModuleName, input);
+
+ int j=0;
+ ArrayList<String> auxModuleNameList = new ArrayList<String>();
+ while(j < testParts.length) {
+ String part = testParts[j];
+ if(part.startsWith("// module "))
+ auxModuleNameList.add(part.substring(10).split("\\n", 2)[0].trim());
+ else
+ break;
+ ++j;
+ }
+ int mainId = j;
+ String[] moduleNames = new String[mainId+1];
+ String[] moduleTexts = new String[mainId+1];
+ for(int i=0;i<mainId;++i) {
+ moduleNames[i] = auxModuleNameList.get(i);
+ moduleTexts[i] = testParts[i];
+ }
+ moduleNames[mainId] = testModuleName;
+
+ for(;j<testParts.length;j+=2) {
+ moduleTexts[mainId] = testParts[j];
+ String expectedOutput = j+1<testParts.length ? testParts[j+1] : "";
+ String actualOutput = test(moduleNames, moduleTexts);