rev: ebafc720a90fa0562f276f82113a43e8e7c3ee88 scopes/testing/test_option.sc -rw-r--r-- 455 bytes View raw Log this file
ebafc720a90f — Leonard Ritter * merged default branch 7 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using import testing
using import Option

# Option unwrap method
do
    let optT = (Option One)
    let opt = (optT (One 1234))
    let opt2 = (optT)
    let result =
        try ('unwrap opt)
        else
            error "unwrap failed"
    test (result == (One 1234))
    let fallback = (One 12345)
    let result =
        try (deref ('unwrap opt2))
        else (view fallback)
    test (result == (One 12345))
    ;

One.test-refcount-balanced;

;