forked from objectionary/eo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
objectionary#3461 Add Expect for EOnumber$EOplus
- Loading branch information
1 parent
c783fd2
commit 4e2e0ab
Showing
2 changed files
with
51 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
eo-runtime/src/test/java/EOorg/EOeolang/EOnumber$EOplusTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package EOorg.EOeolang; | ||
|
||
import org.eolang.Attr; | ||
import org.eolang.Data; | ||
import org.eolang.Dataized; | ||
import org.eolang.ExAbstract; | ||
import org.eolang.PhWith; | ||
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.Matchers; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* Test case for {@link EOnumber$EOplus}. | ||
* | ||
* @since 0.51 | ||
* @checkstyle TypeNameCheck (3 lines) | ||
*/ | ||
@SuppressWarnings("PMD.AvoidDollarSigns") | ||
final class EOnumber$EOplusTest { | ||
|
||
@Test | ||
void throwsCorrectError() { | ||
MatcherAssert.assertThat( | ||
"the message in the error is correct", | ||
Assertions.assertThrows( | ||
ExAbstract.class, | ||
() -> new Dataized( | ||
new PhWith( | ||
new PhWith( | ||
new EOnumber$EOplus(), | ||
Attr.RHO, | ||
new Data.ToPhi(42) | ||
), | ||
"x", | ||
new Data.ToPhi(true) | ||
) | ||
).take(), | ||
"addition with TRUE fails with a proper message that explains what happened" | ||
).getMessage(), | ||
Matchers.containsString("number.plus expects its second argument to be a number") | ||
); | ||
} | ||
} |