Add tests for data constructors
commit493bf5a7c0510919ecee944b5587f388c1521a52
authorTancredi Orlando <tancredi.orlando@gmail.com>
dateFri 24 Mar 2023, 20:49 (4 years ago)
parent40ab323
test-snapshots/snapshots-input/Snapshot.Constructor.pursnew file+7
@@ -0,0 +1,7 @@
1+module Snapshot.Constructor where
2+
3+data Maybe a = Just a | Nothing
4+
5+data Tree a
6+ = Nil
7+ | Node (Tree a) a (Tree a)
test-snapshots/snapshots-output/Snapshot.Constructor.ssnew file+30
@@ -0,0 +1,30 @@
1+#!r6rs
2+#!chezscheme
3+(library
4+ (Snapshot.Constructor lib)
5+ (export
6+ Just
7+ Nil
8+ Node
9+ Nothing)
10+ (import
11+ (prefix (chezscheme) scm:)
12+ (prefix (_Chez_Runtime lib) rt:))
13+
14+ (scm:define Nil
15+ (scm:lambda ()
16+ (scm:cons (scm:quote Nil) scm:nil)))
17+
18+ (scm:define Node
19+ (scm:lambda (value0)
20+ (scm:lambda (value1)
21+ (scm:lambda (value2)
22+ (scm:cons (scm:quote Node) (scm:vector value0 value1 value2))))))
23+
24+ (scm:define Just
25+ (scm:lambda (value0)
26+ (scm:cons (scm:quote Just) (scm:vector value0))))
27+
28+ (scm:define Nothing
29+ (scm:lambda ()
30+ (scm:cons (scm:quote Nothing) scm:nil))))