Libraryless. Click here for Pure Java version (1483L/10K/35K).
1 | !7 |
2 | |
3 | p {
|
4 | final Either<S, Int> a = either1('Hello);
|
5 | final Either<S, Int> b = either2(123); |
6 | |
7 | assertTrue(a.isA()); |
8 | assertFalse(a.isB()); |
9 | assertFalse(b.isA()); |
10 | assertTrue(b.isB()); |
11 | |
12 | assertEqualsVerbose('Hello, a.a());
|
13 | assertFail(r { a.b() });
|
14 | |
15 | assertEqualsVerbose(123, b.b()); |
16 | assertFail(r { b.a() });
|
17 | |
18 | print("OK!");
|
19 | } |
Began life as a copy of #1009170
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1009174 |
| Snippet name: | Test Either (union type) |
| Eternal ID of this version: | #1009174/1 |
| Text MD5: | f7b5067707e9b0106e76439f69b68820 |
| Transpilation MD5: | 204a6d5f4f4ed6b4f18783a877a93291 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX source code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-07-12 13:31:12 |
| Source code size: | 361 bytes / 19 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 788 / 951 |
| Referenced in: | [show references] |