Skip to content

Commit 5f13198

Browse files
committed
feat(test): skipping non-test (helper state) files
Closes: #74
1 parent aebf26f commit 5f13198

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/java/ru/ewc/checklogic/testing/CheckFile.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import ru.ewc.decisions.api.RuleFragments;
3636
import ru.ewc.decisions.commands.Assignment;
3737
import ru.ewc.decisions.conditions.Condition;
38+
import ru.ewc.decisions.core.Coordinate;
3839

3940
/**
4041
* I am a single file containing one or more tests. I am responsible for performing all the tests
@@ -73,6 +74,7 @@ public CheckFile(final String file, final List<RuleFragments> tests, final Strin
7374
public List<TestResult> performChecks(final String root, final CheckSuite files) {
7475
this.suite = files;
7576
return this.tests.stream()
77+
.filter(rule -> rule.getFragments().stream().anyMatch(f -> f.nonEmptyOfType("CND")))
7678
.map(rule -> this.getTestResult(rule, ServerContextFactory.create(root).context()))
7779
.toList();
7880
}
@@ -93,7 +95,7 @@ private TestResult getTestResult(final RuleFragments rule, final ComputationCont
9395
if (!check.evaluate(ctx)) {
9496
failures.add(new CheckFailure(check.asString(), check.result()));
9597
}
96-
} catch (final DecitaException exception) {
98+
} catch (final DecitaException | IllegalArgumentException exception) {
9799
failures.add(
98100
new CheckFailure(
99101
check.asString(),
@@ -104,7 +106,7 @@ private TestResult getTestResult(final RuleFragments rule, final ComputationCont
104106
} else {
105107
try {
106108
this.perform(fragment, ctx);
107-
} catch (DecitaException exception) {
109+
} catch (final DecitaException | IllegalArgumentException exception) {
108110
failures.add(new CheckFailure("", exception.getMessage()));
109111
}
110112
}
@@ -123,7 +125,9 @@ private void perform(final RuleFragment fragment, final ComputationContext ctx)
123125
case "ASG" -> new Assignment(fragment.left(), fragment.right()).performIn(ctx);
124126
case "EXE" -> {
125127
if ("command".equals(fragment.left())) {
126-
ctx.perform(fragment.right());
128+
final Coordinate coordinate = Coordinate.from(fragment.right());
129+
coordinate.resolveIn(ctx);
130+
ctx.perform(coordinate.valueIn(ctx));
127131
ctx.resetComputationState(this.request);
128132
}
129133
if ("include".equals(fragment.left())) {

0 commit comments

Comments
 (0)