Skip to content

Commit 6eef5b2

Browse files
committed
Fix test configs and utils (#2712)
* Do not import test configs in production. * Consistent test config paths. * Whitespace. * Reuse. * Import test configs in test utils. * Add imports where needed. * Add another missing import.
1 parent 751452a commit 6eef5b2

6 files changed

Lines changed: 8 additions & 10 deletions

File tree

src/org/rascalmpl/compiler/CheckTestSources.rsc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import util::FileSystem;
3636
import util::Benchmark;
3737
import lang::rascalcore::compile::util::Names;
3838
import lang::rascalcore::check::RascalConfig;
39+
import lang::rascalcore::check::TestConfigs;
3940

4041

4142
void main() = checkTestSources([]);

src/org/rascalmpl/compiler/CompileTestSources.rsc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import lang::rascalcore::compile::Compile;
4040
import util::FileSystem;
4141
import util::Benchmark;
4242
import lang::rascalcore::compile::util::Names;
43+
import lang::rascalcore::check::TestConfigs;
4344

4445
loc GIT_REPO = |file:///Users/paulklint/git/|;
4546

src/org/rascalmpl/compiler/GenerateTestSources.rsc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import util::Monitor;
3838
import util::Benchmark;
3939
import lang::rascalcore::compile::util::Names;
4040
import util::SystemAPI;
41+
import lang::rascalcore::check::TestConfigs;
4142

4243
// if cmdLineArgs contains "all", then all files in the rascal project are used (~400 files)
4344
// otherwise only standard library and test files (~200 files)

src/org/rascalmpl/compiler/lang/rascalcore/check/Checker.rsc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ extend lang::rascalcore::check::CheckerCommon;
4646

4747
import lang::rascalcore::compile::CompileTimeError;
4848
import lang::rascalcore::check::ModuleLocations;
49-
extend lang::rascalcore::check::TestConfigs;
5049

5150
import analysis::typepal::Exception;
5251

src/org/rascalmpl/compiler/lang/rascalcore/check/TestConfigs.rsc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public PathConfig makePathConfig(list[loc] sources, list[loc] libraries, bool ke
127127
generatedSources = COMPILED + "/src/main/java",
128128
generatedTestSources = COMPILED + "/src/test/java/",
129129
generatedResources = COMPILED + (keep ? "/src/main/java" : "rascal"),
130-
generatedTestResources = COMPILED_RASCAL + (keep ? "/src/test/java/" : "rascal"),
130+
generatedTestResources = COMPILED + (keep ? "/src/test/java/" : "rascal"),
131131
libs = libraries
132132
);
133133
}
@@ -190,7 +190,7 @@ public PathConfig getAllSrcWritablePathConfig(bool keep = false) {
190190
TMP_TYPEPAL
191191
],
192192
[ ],
193-
keep=true);
193+
keep=keep);
194194
}
195195

196196
public RascalCompilerConfig getAllSrcWritableCompilerConfig(bool keep=true){

src/org/rascalmpl/compiler/lang/rascalcore/check/tests/StaticTestingUtils.rsc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import ParseTree;
4747
import lang::rascalcore::check::RascalConfig;
4848

4949
import lang::rascalcore::check::Checker;
50+
import lang::rascalcore::check::TestConfigs;
5051
import lang::rascal::\syntax::Rascal;
5152

5253
import analysis::typepal::LocationChecks;
@@ -117,7 +118,7 @@ set[Message] getAllMessages(ModuleStatus r)
117118
ModuleStatus checkStatements(str stmts) {
118119
clearMemory();
119120
mloc = composeModule(stmts);
120-
return rascalTModelForLocs([mloc], rascalCompilerConfig(pathConfigForTesting())[infoModuleChecked=true][verbose=verbose], dummy_compile1);
121+
return rascalTModelForLocs([mloc], rascalCompilerConfig(pathConfigForTesting())[infoModuleChecked=true][verbose=verbose], dummy_compile1);
121122
}
122123

123124
ModuleStatus checkModule(str moduleText){
@@ -169,12 +170,7 @@ bool checkOK(str stmts) {
169170
throw errors;
170171
}
171172

172-
bool checkModuleOK(loc moduleToCheck, PathConfig pathConfig = pathConfigForTesting()) {
173-
errors = getErrorMessages(rascalTModelForLocs([moduleToCheck], rascalCompilerConfig(pathConfig)[infoModuleChecked=true][verbose=verbose], dummy_compile1));
174-
if(size(errors) == 0)
175-
return true;
176-
throw abbrev("<errors>");
177-
}
173+
bool checkModuleOK(loc moduleToCheck, PathConfig pathConfig = pathConfigForTesting()) = checkModulesOK([moduleToCheck], pathConfig = pathConfig);
178174

179175
bool checkModulesOK(list[loc] modulesToCheck, PathConfig pathConfig = pathConfigForTesting()) {
180176
errors = getErrorMessages(rascalTModelForLocs(modulesToCheck, rascalCompilerConfig(pathConfig)[infoModuleChecked=true][verbose=verbose], dummy_compile1));

0 commit comments

Comments
 (0)