mirror of
https://github.com/aNNiMON/Own-Programming-Language-Tutorial.git
synced 2024-09-20 08:44:20 +03:00
Fix concurrent modification exception in ounit, when new modules are loaded in test
This commit is contained in:
parent
99bdd1c953
commit
90db2b0aa3
@ -88,8 +88,10 @@ public final class ounit implements Module {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Value execute(Value[] args) {
|
public Value execute(Value[] args) {
|
||||||
List<TestInfo> tests = Functions.getFunctions().entrySet().stream()
|
final var testFunctions = ScopeHandler.functions().entrySet().stream()
|
||||||
.filter(e -> e.getKey().toLowerCase().startsWith("test"))
|
.filter(e -> e.getKey().toLowerCase().startsWith("test"))
|
||||||
|
.toList();
|
||||||
|
List<TestInfo> tests = testFunctions.stream()
|
||||||
.map(e -> runTest(e.getKey(), e.getValue()))
|
.map(e -> runTest(e.getKey(), e.getValue()))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
@ -133,19 +135,12 @@ public final class ounit implements Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TestInfo {
|
private record TestInfo(
|
||||||
final String name;
|
String name,
|
||||||
final boolean isPassed;
|
boolean isPassed,
|
||||||
final String failureDescription;
|
String failureDescription,
|
||||||
final long elapsedTimeInMicros;
|
long elapsedTimeInMicros
|
||||||
|
) {
|
||||||
public TestInfo(String name, boolean isPassed, String failureDescription, long elapsedTimeInMicros) {
|
|
||||||
this.name = name;
|
|
||||||
this.isPassed = isPassed;
|
|
||||||
this.failureDescription = failureDescription;
|
|
||||||
this.elapsedTimeInMicros = elapsedTimeInMicros;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String info() {
|
public String info() {
|
||||||
return String.format("%s [%s]\n%sElapsed: %s\n",
|
return String.format("%s [%s]\n%sElapsed: %s\n",
|
||||||
name,
|
name,
|
||||||
|
Loading…
Reference in New Issue
Block a user