lawspec 0.20.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +297 -2
- package/README.md +3 -3
- package/bin/lawspec.mjs +260 -32
- package/build.json +292 -100
- package/core.wasm +0 -0
- package/core_jsffi.js +2 -2
- package/examples/specs/abilities.lawspec +103 -0
- package/examples/specs/ability_imports.lawspec +107 -0
- package/examples/specs/builtins.lawspec +121 -0
- package/examples/specs/crypto.lawspec +51 -0
- package/examples/specs/distribution.lawspec +29 -0
- package/examples/specs/failures.lawspec +96 -0
- package/examples/specs/handler_bindings.lawspec +65 -0
- package/examples/specs/harness.lawspec +75 -0
- package/examples/specs/harness_testing.lawspec +45 -0
- package/examples/specs/matchers.lawspec +112 -0
- package/examples/specs/resources.lawspec +116 -0
- package/examples/specs/scheduling_order.lawspec +18 -0
- package/examples/specs/scheduling_overlap.lawspec +14 -0
- package/examples/specs/tables.lawspec +64 -0
- package/index.d.ts +2 -0
- package/package.json +1 -1
- package/templates.mjs +14 -14
- package/test-command.mjs +165 -30
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
-- The harness of example.harness: how its laws are tested. A harness
|
|
2
|
+
-- cannot change what a law means; it chooses inputs, handlers, adequacy and
|
|
3
|
+
-- how the tests run.
|
|
4
|
+
harness example.harness.testing for example.harness is
|
|
5
|
+
-- Small orders: up to three items at a dollar each.
|
|
6
|
+
strategy smallOrder :: Order is
|
|
7
|
+
bind items :: Int32 from (one of 0, 1, 2, 3) in one of Order items (items * 100)
|
|
8
|
+
end
|
|
9
|
+
-- Bulk orders: the default generator, kept to large ones.
|
|
10
|
+
strategy bulkOrder :: Order is
|
|
11
|
+
any such that itemsOf it > 10 && totalOf it >= 0 at most 1000 discards
|
|
12
|
+
end
|
|
13
|
+
strategy orders :: Order is frequency 9 smallOrder, 1 bulkOrder end
|
|
14
|
+
|
|
15
|
+
tags pricing
|
|
16
|
+
test with fakeLedger
|
|
17
|
+
order random
|
|
18
|
+
parallel
|
|
19
|
+
|
|
20
|
+
for law `a discount is never more than the total`
|
|
21
|
+
use orders for order
|
|
22
|
+
cover 5% "empty order" when isEmpty order
|
|
23
|
+
classify totalOf order > 1000 as "large"
|
|
24
|
+
label if isEmpty order then "empty" else "some items"
|
|
25
|
+
timeout 10 s
|
|
26
|
+
|
|
27
|
+
for law `rounding is idempotent`
|
|
28
|
+
target maximize cents
|
|
29
|
+
repeat 2
|
|
30
|
+
retry flaky 1
|
|
31
|
+
|
|
32
|
+
for law `rounding never lowers a price`
|
|
33
|
+
known failing "rounds half down; see PRICE-12"
|
|
34
|
+
|
|
35
|
+
for law `a refund is never booked twice`
|
|
36
|
+
skip "refunds are not booked yet"
|
|
37
|
+
|
|
38
|
+
for laws `booking a positive amount succeeds`, `positive amounts are accepted`
|
|
39
|
+
tags ledger
|
|
40
|
+
|
|
41
|
+
share Scratch per unit
|
|
42
|
+
benchmark `discount of a bulk order` is discount (Order 30 50000) end
|
|
43
|
+
-- book uses Ledger: the benchmark runs under its production handler.
|
|
44
|
+
benchmark `booking a payment` is book 500 end
|
|
45
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
unit example.matchers
|
|
2
|
+
|
|
3
|
+
-- Matchers are typed predicates that read like sentences. Each one is a
|
|
4
|
+
-- Bool, so a law may combine them with && and ||, and an example may expect
|
|
5
|
+
-- one to hold.
|
|
6
|
+
|
|
7
|
+
type Order is
|
|
8
|
+
| Pending id :: Int32
|
|
9
|
+
| Shipped id :: Int32 carrier :: Text
|
|
10
|
+
| Cancelled id :: Int32 reason :: Maybe Text
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
-- Native adapters, written on each target.
|
|
14
|
+
sortItems :: List Int32 -> List Int32
|
|
15
|
+
uniqueTags :: List Text -> List Text
|
|
16
|
+
average :: Int32 -> Int32 -> Float64
|
|
17
|
+
slug :: Text -> Text
|
|
18
|
+
ship :: Int32 -> Order
|
|
19
|
+
|
|
20
|
+
law `sorting keeps every item` is
|
|
21
|
+
definition is
|
|
22
|
+
`for all` (xs :: List Int32) . sortItems xs has same items as xs
|
|
23
|
+
end
|
|
24
|
+
example `duplicates stay` is
|
|
25
|
+
xs = [3, 1, 3]
|
|
26
|
+
expect sortItems xs = [1, 3, 3]
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
law `unique tags come from the input` is
|
|
31
|
+
definition is
|
|
32
|
+
`for all` (tags :: List Text) .
|
|
33
|
+
uniqueTags tags is subset of tags && tags contains all of uniqueTags tags
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
law `unique tags keep each tag` is
|
|
38
|
+
definition is
|
|
39
|
+
`for all` (tags :: List Text) (tag :: Text) .
|
|
40
|
+
tags contains tag implies uniqueTags tags contains tag
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
law `the average lies between the two` is
|
|
45
|
+
definition is
|
|
46
|
+
`for all` (a :: Int32) (b :: Int32) .
|
|
47
|
+
average a b is within 0.5 of prelude.Float64 (prelude.quot (a + b) 2)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
law `a slug is lowercase words joined by dashes` is
|
|
52
|
+
definition is
|
|
53
|
+
`for all` (title :: Text) .
|
|
54
|
+
slug title matches regex "([a-z0-9]+(-[a-z0-9]+)*)?"
|
|
55
|
+
end
|
|
56
|
+
example `a title` is
|
|
57
|
+
title = "Hello World"
|
|
58
|
+
expect slug title = "hello-world"
|
|
59
|
+
expect slug title starts with "hello"
|
|
60
|
+
expect slug title ends with "world"
|
|
61
|
+
expect slug title contains "o-w"
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
law `shipping gives a shipped order` is
|
|
66
|
+
definition is
|
|
67
|
+
`for all` (id :: Int32) . ship id matches Shipped _ _
|
|
68
|
+
end
|
|
69
|
+
example `the carrier is never empty` is
|
|
70
|
+
id = 7
|
|
71
|
+
expect ship id matches Shipped 7 _
|
|
72
|
+
expect !(ship id matches Shipped _ "")
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
-- Laws of the matchers themselves.
|
|
77
|
+
law `having the same items is symmetric` is
|
|
78
|
+
definition is
|
|
79
|
+
`for all` (xs :: List Int8) (ys :: List Int8) .
|
|
80
|
+
(xs has same items as ys) = (ys has same items as xs)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
law `a list contains each of its items` is
|
|
85
|
+
definition is
|
|
86
|
+
`for all` (x :: Int8) (xs :: List Int8) . Cons x xs contains x
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
law `a list is a subset of itself` is
|
|
91
|
+
definition is
|
|
92
|
+
`for all` (xs :: List Int8) . xs is subset of xs && xs contains all of xs
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
law `a text starts and ends with itself` is
|
|
97
|
+
definition is
|
|
98
|
+
`for all` (t :: Text) . t starts with t && t ends with t && t contains t && t contains ""
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
law `a number is within any tolerance of itself` is
|
|
103
|
+
definition is
|
|
104
|
+
`for all` (x :: Int32) (d :: Int32 where d >= 0) . x is within d of x
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
law `a regex value matches like a literal` is
|
|
109
|
+
definition is
|
|
110
|
+
`for all` (t :: Text) . (t matches regex "[a-c]*") = (t matches regex "[a-c]*")
|
|
111
|
+
end
|
|
112
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
unit example.resources
|
|
2
|
+
|
|
3
|
+
-- A resource is something a law needs that lives outside the program: a
|
|
4
|
+
-- store, a directory, a port. Each case of a law acquires its resources
|
|
5
|
+
-- first and releases them after, even when the case fails, so every case
|
|
6
|
+
-- starts afresh and nothing leaks.
|
|
7
|
+
|
|
8
|
+
-- A store the tests open, use and close. Only adapters make one.
|
|
9
|
+
handle Store
|
|
10
|
+
|
|
11
|
+
openStore :: Unit -> Store
|
|
12
|
+
closeStore :: Store -> Unit
|
|
13
|
+
clearStore :: Store -> Unit
|
|
14
|
+
put :: Store -> Int32 -> Int32 -> Unit
|
|
15
|
+
get :: Store -> Int32 -> Maybe Int32
|
|
16
|
+
isOpen :: Store -> Bool
|
|
17
|
+
size :: Store -> Int32
|
|
18
|
+
|
|
19
|
+
resource Store is
|
|
20
|
+
acquire is openStore unitValue end
|
|
21
|
+
release store is closeStore store end
|
|
22
|
+
reset store is clearStore store end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
law `a stored value can be read back` for store :: Store is
|
|
26
|
+
definition is
|
|
27
|
+
`for all` (k :: Int32) (v :: Int32) . put store k v = unitValue and get store k = Just v
|
|
28
|
+
end
|
|
29
|
+
example `the store is open while the case runs` is
|
|
30
|
+
k = 1
|
|
31
|
+
v = 2
|
|
32
|
+
expect isOpen store
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
law `every case gets an empty store` for store :: Store is
|
|
37
|
+
definition is
|
|
38
|
+
`for all` (k :: Int32) (v :: Int32) .
|
|
39
|
+
size store = 0 and put store k v = unitValue and size store = 1
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
-- Built-in resources: a temporary directory, a free port, and the
|
|
44
|
+
-- environment, saved and restored.
|
|
45
|
+
writeNote :: Text -> Int32 -> Unit
|
|
46
|
+
readNote :: Text -> Maybe Int32
|
|
47
|
+
canListen :: Int32 -> Bool
|
|
48
|
+
setGreeting :: Int32 -> Unit
|
|
49
|
+
greeting :: Unit -> Maybe Int32
|
|
50
|
+
|
|
51
|
+
law `a note reads back` for dir :: TemporaryDirectory is
|
|
52
|
+
definition is
|
|
53
|
+
`for all` (n :: Int32) .
|
|
54
|
+
writeNote (directoryPath dir) n = unitValue and readNote (directoryPath dir) = Just n
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
law `a new directory has no note` for dir :: TemporaryDirectory is
|
|
59
|
+
definition is
|
|
60
|
+
readNote (directoryPath dir) = Nothing
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
law `a free port can be listened on` for port :: FreePort is
|
|
65
|
+
definition is
|
|
66
|
+
canListen (portNumber port) = true
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
law `the greeting is the one set` for saved :: SavedEnvironment is
|
|
71
|
+
definition is
|
|
72
|
+
`for all` (n :: Int32) . setGreeting n = unitValue and greeting unitValue = Just n
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
law `the environment is restored after each case` for saved :: SavedEnvironment is
|
|
77
|
+
definition is
|
|
78
|
+
greeting unitValue = Nothing
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
-- A pool is costly to open, so the harness shares one between the cases of
|
|
83
|
+
-- this unit's laws. Sharing is allowed only because Pool declares reset:
|
|
84
|
+
-- every case after the first gets the pool drained, so no case sees what
|
|
85
|
+
-- another left in it, and the law means the same as with a fresh pool.
|
|
86
|
+
handle Pool
|
|
87
|
+
|
|
88
|
+
openPool :: Unit -> Pool
|
|
89
|
+
drainPool :: Pool -> Unit
|
|
90
|
+
closePool :: Pool -> Unit
|
|
91
|
+
fill :: Pool -> Int32 -> Unit
|
|
92
|
+
level :: Pool -> Int32
|
|
93
|
+
|
|
94
|
+
resource Pool is
|
|
95
|
+
acquire is openPool unitValue end
|
|
96
|
+
release pool is closePool pool end
|
|
97
|
+
reset pool is drainPool pool end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
law `a pool starts each case empty` for pool :: Pool is
|
|
101
|
+
definition is
|
|
102
|
+
`for all` (n :: Int32 where n > 0 && n <= 100) .
|
|
103
|
+
level pool = 0 and fill pool n = unitValue and level pool = n
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
law `filling twice adds up` for pool :: Pool is
|
|
108
|
+
definition is
|
|
109
|
+
`for all` (a :: Int32 where a > 0 && a <= 100) (b :: Int32 where b > 0 && b <= 100) .
|
|
110
|
+
fill pool a = unitValue and fill pool b = unitValue and level pool = a + b
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
harness example.resources.testing for example.resources is
|
|
115
|
+
share Pool per unit
|
|
116
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
unit example.sequencing
|
|
2
|
+
|
|
3
|
+
-- How a harness orders a unit's laws never changes what they mean. The
|
|
4
|
+
-- scheduling acceptance suite checks that `order random` follows the run's
|
|
5
|
+
-- seed: the same seed gives the same order, and other seeds other orders.
|
|
6
|
+
-- pause notes when it is called (when the suite asks it to) and gives true.
|
|
7
|
+
pause :: Int32 -> Bool
|
|
8
|
+
|
|
9
|
+
law `the first pause ends` is definition is pause 1 = true end end
|
|
10
|
+
law `the second pause ends` is definition is pause 2 = true end end
|
|
11
|
+
law `the third pause ends` is definition is pause 3 = true end end
|
|
12
|
+
law `the fourth pause ends` is definition is pause 4 = true end end
|
|
13
|
+
law `the fifth pause ends` is definition is pause 5 = true end end
|
|
14
|
+
law `the sixth pause ends` is definition is pause 6 = true end end
|
|
15
|
+
|
|
16
|
+
harness example.sequencing.testing for example.sequencing is
|
|
17
|
+
order random
|
|
18
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
unit example.overlap
|
|
2
|
+
|
|
3
|
+
-- How a harness runs a unit's laws never changes what they mean. The
|
|
4
|
+
-- scheduling acceptance suite checks that `parallel` runs them at the same
|
|
5
|
+
-- time: each nap sleeps, and their sleeps overlap.
|
|
6
|
+
async nap :: Int32 -> Bool
|
|
7
|
+
|
|
8
|
+
law `the first nap ends` is definition is nap 101 = true end end
|
|
9
|
+
law `the second nap ends` is definition is nap 102 = true end end
|
|
10
|
+
law `the third nap ends` is definition is nap 103 = true end end
|
|
11
|
+
|
|
12
|
+
harness example.overlap.testing for example.overlap is
|
|
13
|
+
parallel
|
|
14
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
unit example.tables
|
|
2
|
+
|
|
3
|
+
-- Examples three ways: as rows of a table, as examples written in a law's
|
|
4
|
+
-- description, and as values recorded in the project.
|
|
5
|
+
|
|
6
|
+
shippingCost :: Int32 -> Int32 -> Int32
|
|
7
|
+
label :: Int32 -> Text
|
|
8
|
+
|
|
9
|
+
-- Each row is its own example. The column on the right of an expect's =
|
|
10
|
+
-- holds the expected values; the other columns bind the law's inputs.
|
|
11
|
+
law `shipping cost grows with weight and distance` is
|
|
12
|
+
definition is
|
|
13
|
+
`for all` (kilograms :: Int32 where kilograms >= 0 && kilograms <= 1000)
|
|
14
|
+
(kilometres :: Int32 where kilometres >= 0 && kilometres <= 1000) .
|
|
15
|
+
shippingCost kilograms kilometres >= 0
|
|
16
|
+
end
|
|
17
|
+
table (kilograms, kilometres, cost) is
|
|
18
|
+
row 0, 0, 0
|
|
19
|
+
row 1, 10, 15
|
|
20
|
+
row 2, 10, 30
|
|
21
|
+
row 10, 100, 1050
|
|
22
|
+
expect shippingCost kilograms kilometres = cost
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
-- Examples in a description are fenced, and become examples of the law.
|
|
27
|
+
law `a label names the parcel` is
|
|
28
|
+
definition is
|
|
29
|
+
`for all` (parcel :: Int32 where parcel >= 0) . label parcel starts with "parcel "
|
|
30
|
+
end
|
|
31
|
+
description is
|
|
32
|
+
"Every label starts with the word parcel and the parcel's number.
|
|
33
|
+
|
|
34
|
+
```example
|
|
35
|
+
parcel = 7
|
|
36
|
+
expect label parcel = \"parcel 7\"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```example `a large number`
|
|
40
|
+
parcel = 123456
|
|
41
|
+
expect label parcel = \"parcel 123456\"
|
|
42
|
+
```"
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
-- A recorded value is stored in the project, under
|
|
47
|
+
-- recorded/example.tables/<name>, in the portable rendering every target
|
|
48
|
+
-- shares. lawspec test --update-recorded records it again; until then, a
|
|
49
|
+
-- changed value fails.
|
|
50
|
+
law `the first label is recorded` is
|
|
51
|
+
definition is
|
|
52
|
+
label 1 = recorded "first label"
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
law `labels are short` is
|
|
57
|
+
definition is
|
|
58
|
+
`for all` (parcel :: Int32 where parcel >= 0) . prelude.length (label parcel) <= 20
|
|
59
|
+
end
|
|
60
|
+
example `parcel 42` is
|
|
61
|
+
parcel = 42
|
|
62
|
+
expect label parcel = recorded "parcel 42"
|
|
63
|
+
end
|
|
64
|
+
end
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
package/templates.mjs
CHANGED
|
@@ -24,14 +24,14 @@ export const commands = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export const setup = {
|
|
27
|
-
"java": "Use JDK 25+, Maven, JetCheck 0.3.0, JUnit Jupiter 5.14.x, compiler plugin 3.14.1+, Surefire 3.5.x, and maven.compiler.release=25. Run mvn test-compile.",
|
|
28
|
-
"python": "Use Python 3.13+. Install pytest 8.4.x and Hypothesis 6.x into the selected environment: python -m pip install -e \".[test]\". Configure pytest pythonpath=[\"src\"] and testpaths=[\"tests\"]. Set the target python field to the interpreter path if needed.",
|
|
29
|
-
"javascript": "Use Node 22+, package.json type=module,
|
|
30
|
-
"typescript": "Use Node 22+, package.json type=module,
|
|
31
|
-
"go": "Use Go 1.
|
|
32
|
-
"haskell": "Use Stack with lts-24.58 and test dependencies hspec, hedgehog, hspec-hedgehog, hspec-discover, and a test/Spec.hs using hspec-discover. Run stack build --test --no-run-tests.",
|
|
33
|
-
"kotlin": "Use JDK 25, Gradle 9.3.0, Kotlin plugin 2.3.21, JVM target 25, Kotest 5.9.1 (runner, assertions, property), and useJUnitPlatform(). Run gradle testClasses.",
|
|
34
|
-
"rust": "Use Rust 1.85+ with edition 2024, Proptest 1.11.0, num-bigint 0.4.8, num-rational 0.4.2, num-complex 0.4.6
|
|
27
|
+
"java": "Use JDK 25+, Maven, JetCheck 0.3.0, JUnit Jupiter 5.14.x, compiler plugin 3.14.1+, Surefire 3.5.x, and maven.compiler.release=25; a program that imports lawspec.crypto or lawspec.network also needs Bouncy Castle bcprov-jdk18on 1.86. Run mvn test-compile.",
|
|
28
|
+
"python": "Use Python 3.13+. Install pytest 8.4.x and Hypothesis 6.x into the selected environment, and, for a program that imports lawspec.crypto or lawspec.network, cryptography 50: python -m pip install -e \".[test]\". Configure pytest pythonpath=[\"src\"] and testpaths=[\"tests\"]. Set the target python field to the interpreter path if needed.",
|
|
29
|
+
"javascript": "Use Node 22+, package.json type=module, npm install --save-dev fast-check@4.10.2, and for a program that imports lawspec.crypto or lawspec.network npm install @noble/post-quantum@0.7.1.",
|
|
30
|
+
"typescript": "Use Node 22+, package.json type=module, npm install --save-dev fast-check@4.10.2 typescript@5.9.3 @types/node@22.20.4 (and npm install @noble/post-quantum@0.7.1 for a program that imports lawspec.crypto or lawspec.network). Configure tsconfig.json with module=NodeNext, target=ES2022, rootDir=., outDir=dist, include=[\"src/**/*.ts\",\"test/**/*.ts\"].",
|
|
31
|
+
"go": "Use Go 1.25+ and go get pgregory.net/rapid@v1.2.0 (and github.com/cloudflare/circl@v1.6.5 for a program that imports lawspec.crypto or lawspec.network), then go mod download.",
|
|
32
|
+
"haskell": "Use Stack with lts-24.58, directory and time as dependencies (and, for a program that imports lawspec.crypto, lawspec.network or lawspec.randomness, extra-deps crypton-1.1.5, ram-0.22.1, mlkem-0.2.3.0 and mldsa-0.1.1.0 as dependencies too), and test dependencies hspec, hedgehog, hspec-hedgehog, hspec-discover, and a test/Spec.hs using hspec-discover. Run stack build --test --no-run-tests.",
|
|
33
|
+
"kotlin": "Use JDK 25, Gradle 9.3.0, Kotlin plugin 2.3.21, JVM target 25, Kotest 5.9.1 (runner, assertions, property), and useJUnitPlatform(); a program that imports lawspec.crypto or lawspec.network also needs Bouncy Castle bcprov-jdk18on 1.86. Run gradle testClasses.",
|
|
34
|
+
"rust": "Use Rust 1.85+ with edition 2024, Proptest 1.11.0, num-bigint 0.4.8, num-rational 0.4.2, num-complex 0.4.6 and num-traits 0.2.19; a program that imports lawspec.crypto, lawspec.network or lawspec.randomness also needs sha3 0.12.0, shake 0.1.0, ml-kem 0.3.2, ml-dsa 0.1.1, slh-dsa 0.2.0-rc.5, aes-gcm 0.11.1 and getrandom 0.4.3. Run cargo test."
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
// Each target's build files in the readable and the compact (minified) layout.
|
|
@@ -46,10 +46,10 @@ const scaffolds = {
|
|
|
46
46
|
},
|
|
47
47
|
"python": {
|
|
48
48
|
"readable": {
|
|
49
|
-
"pyproject.toml": "[build-system]\nrequires = [\"setuptools==80.9.0\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[project]\nname = \"lawspec-example\"\nversion = \"0.1.0\"\nrequires-python = \">=3.13\"\n\n[project.optional-dependencies]\ntest = [\"pytest==8.4.2\", \"hypothesis==6.135.26\"]\n\n[tool.setuptools.packages.find]\nwhere = [\"src\"]\n\n[tool.pytest.ini_options]\npythonpath = [\"src\"]\ntestpaths = [\"tests\"]\n"
|
|
49
|
+
"pyproject.toml": "[build-system]\nrequires = [\"setuptools==80.9.0\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[project]\nname = \"lawspec-example\"\nversion = \"0.1.0\"\nrequires-python = \">=3.13\"\ndependencies = []\n\n[project.optional-dependencies]\ntest = [\"pytest==8.4.2\", \"hypothesis==6.135.26\"]\n\n[tool.setuptools.packages.find]\nwhere = [\"src\"]\n\n[tool.pytest.ini_options]\npythonpath = [\"src\"]\ntestpaths = [\"tests\"]\n"
|
|
50
50
|
},
|
|
51
51
|
"compact": {
|
|
52
|
-
"pyproject.toml": "[build-system]\nrequires = [\"setuptools==80.9.0\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[project]\nname = \"lawspec-example\"\nversion = \"0.1.0\"\nrequires-python = \">=3.13\"\n\n[project.optional-dependencies]\ntest = [\"pytest==8.4.2\", \"hypothesis==6.135.26\"]\n\n[tool.setuptools.packages.find]\nwhere = [\"src\"]\n\n[tool.pytest.ini_options]\npythonpath = [\"src\"]\ntestpaths = [\"tests\"]\n"
|
|
52
|
+
"pyproject.toml": "[build-system]\nrequires = [\"setuptools==80.9.0\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[project]\nname = \"lawspec-example\"\nversion = \"0.1.0\"\nrequires-python = \">=3.13\"\ndependencies = []\n\n[project.optional-dependencies]\ntest = [\"pytest==8.4.2\", \"hypothesis==6.135.26\"]\n\n[tool.setuptools.packages.find]\nwhere = [\"src\"]\n\n[tool.pytest.ini_options]\npythonpath = [\"src\"]\ntestpaths = [\"tests\"]\n"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"javascript": {
|
|
@@ -72,21 +72,21 @@ const scaffolds = {
|
|
|
72
72
|
},
|
|
73
73
|
"go": {
|
|
74
74
|
"readable": {
|
|
75
|
-
"go.mod": "module example.com/lawspec-example\n\ngo 1.
|
|
75
|
+
"go.mod": "module example.com/lawspec-example\n\ngo 1.25.0\n\nrequire pgregory.net/rapid v1.2.0\n"
|
|
76
76
|
},
|
|
77
77
|
"compact": {
|
|
78
|
-
"go.mod": "module example.com/lawspec-example\n\ngo 1.
|
|
78
|
+
"go.mod": "module example.com/lawspec-example\n\ngo 1.25.0\n\nrequire pgregory.net/rapid v1.2.0\n"
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"haskell": {
|
|
82
82
|
"readable": {
|
|
83
83
|
"stack.yaml": "snapshot: lts-24.58\npackages: [.]\n",
|
|
84
|
-
"package.yaml": "name: lawspec-example\nversion: 0.1.0\ndependencies: [base, text, bytestring, containers, network]\nlibrary:\n source-dirs: src\ntests:\n laws:\n main: Spec.hs\n source-dirs: test\n dependencies: [lawspec-example, hspec, hedgehog, hspec-hedgehog, containers, mtl]\n build-tools: [hspec-discover]\n",
|
|
84
|
+
"package.yaml": "name: lawspec-example\nversion: 0.1.0\ndependencies: [base, text, bytestring, containers, network, directory, time]\nlibrary:\n source-dirs: src\ntests:\n laws:\n main: Spec.hs\n source-dirs: test\n dependencies: [lawspec-example, hspec, hedgehog, hspec-hedgehog, containers, mtl]\n ghc-options: [-threaded, -rtsopts, \"-with-rtsopts=-N\"]\n build-tools: [hspec-discover]\n",
|
|
85
85
|
"test/Spec.hs": "{-# OPTIONS_GHC -F -pgmF hspec-discover #-}\n"
|
|
86
86
|
},
|
|
87
87
|
"compact": {
|
|
88
88
|
"stack.yaml": "snapshot: lts-24.58\npackages: [.]\n",
|
|
89
|
-
"package.yaml": "name: lawspec-example\nversion: 0.1.0\ndependencies: [base, text, bytestring, containers, network]\nlibrary:\n source-dirs: src\ntests:\n laws:\n main: Spec.hs\n source-dirs: test\n dependencies: [lawspec-example, hspec, hedgehog, hspec-hedgehog, containers, mtl]\n build-tools: [hspec-discover]\n",
|
|
89
|
+
"package.yaml": "name: lawspec-example\nversion: 0.1.0\ndependencies: [base, text, bytestring, containers, network, directory, time]\nlibrary:\n source-dirs: src\ntests:\n laws:\n main: Spec.hs\n source-dirs: test\n dependencies: [lawspec-example, hspec, hedgehog, hspec-hedgehog, containers, mtl]\n ghc-options: [-threaded, -rtsopts, \"-with-rtsopts=-N\"]\n build-tools: [hspec-discover]\n",
|
|
90
90
|
"test/Spec.hs": "{-# OPTIONS_GHC -F -pgmF hspec-discover #-}\n"
|
|
91
91
|
}
|
|
92
92
|
},
|