Skip to content

Commit

Permalink
#3461 show result in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Nov 24, 2024
1 parent 1e6f5da commit bf5b9d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion eo-runtime/src/main/java/org/eolang/Expect.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ public Expect<T> must(final Function<T, Boolean> fun) {
() -> {
final T ret = this.sup.get();
if (!fun.apply(ret)) {
throw new ExFailure(this.subject);
throw new ExFailure(
String.format("%s (%s)", this.subject, ret)
);
}
return ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ void takesWrongSlice() {
MatcherAssert.assertThat(
"error message is correct",
baos.toString(),
Matchers.containsString("the 'len' attribute must be a positive integer")
Matchers.allOf(
Matchers.containsString("the 'len' attribute must be a positive integer"),
Matchers.containsString("the 'len' attribute (-5)")
)
);
}

Expand Down

0 comments on commit bf5b9d1

Please sign in to comment.