rev: 3827f53bae88e48a594610914ba74b9512ead6dd tukan/testing/test_module.sc -rw-r--r-- 1.5 KiB View raw Log this file
3827f53bae88 — Leonard Ritter * more work on module system a month 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using import enum
using import testing
using import console

import ..tukan.use
using import tukan.module

fn main ()
    #
    let blob = (Blob "0123456789012345678901234567890123456789")
    let blob2 = (Blob "012345678901234567890123456789012345678910")
    let blob3 = (Blob "0123456789012345678901234567890123456789")
    let blob4 = (Blob "01234567890123456789012345678901234567891023")
    let digest =
        blob.digest
    print digest blob2.digest blob3.digest
    print (blob == blob2)
    print (blob == blob3)
    print "opening module..."
    let mod = (Module "test.csp")

    let act = ('edit mod)

    let blobid = ('store-blob act blob)

    inline test (expr)
        try
            test expr
        except (err)
            raise (err as ModuleError)

    test (blobid == ('store-blob act blob))

    let blobid2 = ('store-blob act blob2)
    test (blobid2 == ('store-blob act blob2))
    test (blobid == ('store-blob act blob))

    print ('digest-id act digest) ('digest-id act blob4.digest)

    let blob5 = ('load-blob act ('digest-id act digest))
    print "blob == blob5?" (blob5 == blob)

    let edge =
        Edge
            TypedId blobid blobid
            TypedId blobid2 blobid2
            TypedId blobid2 blobid2
    'store-edge act edge
    let edge =
        Edge
            TypedId blobid blobid
            TypedId blobid2 blobid2
    print edge
    print
        'load-edge act edge

    #'abort act
    'commit act
    ;

try (main)
except (err)
    raise (err as Error)

;