Libraryless. Click here for Pure Java version (1483L/10K/35K).
1 | !7 |
2 | |
3 | p {
|
4 | final Alt<S, Int> a = alt1('Hello);
|
5 | final Alt<S, Int> b = alt2(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 | } |
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: | #1009170 |
| Snippet name: | Test Alt (union type) |
| Eternal ID of this version: | #1009170/1 |
| Text MD5: | b30adcaa488173e6c1037e62a86765a4 |
| Transpilation MD5: | a310835964fa0606f9bc84eff5a6a5fe |
| 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:26:45 |
| Source code size: | 349 bytes / 19 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 779 / 944 |
| Referenced in: | [show references] |