lawspec 0.26.0 → 0.27.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.
@@ -39,6 +39,14 @@ law "|placing an order prices it| is
39
39
  input = UnvalidatedOrder record{ id = "A-1" , quantity = 100}
40
40
  expect prelude.isRight (placeOrder input) = true
41
41
  end example
42
+ example "|the last quantity within the price limit| :
43
+ input = UnvalidatedOrder record{ id = "A-2" , quantity = 800}
44
+ expect prelude.isRight (placeOrder input) = true
45
+ end example
46
+ example "|the first quantity over the price limit| :
47
+ input = UnvalidatedOrder record{ id = "A-3" , quantity = 801}
48
+ expect prelude.isRight (placeOrder input) = false
49
+ end example
42
50
  end law
43
51
 
44
52
  law "|validation accepts exactly the valid orders| is
@@ -52,6 +60,18 @@ law "|validation accepts exactly the valid orders| is
52
60
  prelude.length id > 0 && quantity >= 1 && quantity <= 1000
53
61
  end case) end for all
54
62
  end definition
63
+ example "|the largest valid quantity is accepted| :
64
+ input = UnvalidatedOrder record{ id = "A-4" , quantity = 1000}
65
+ expect prelude.isRight (validateOrder input) = true
66
+ end example
67
+ example "|a quantity above the declared range is rejected| :
68
+ input = UnvalidatedOrder record{ id = "A-5" , quantity = 1001}
69
+ expect prelude.isRight (validateOrder input) = false
70
+ end example
71
+ example "|zero is not a unit quantity| :
72
+ input = UnvalidatedOrder record{ id = "A-6" , quantity = 0}
73
+ expect prelude.isRight (validateOrder input) = false
74
+ end example
55
75
  end law
56
76
 
57
77
  law "|quantities are always in range| is
@@ -33,7 +33,7 @@ workflow quoted :: Ticket -> Either _ Ticket is
33
33
  timeout 200ms
34
34
  end workflow
35
35
 
36
- -- An asynchronous step with a hedge: ticket -2's first quote stalls (600ms),
36
+ -- An asynchronous step with a hedge: ticket -2's first quote stalls,
37
37
  -- so a second starts after 50ms and answers first.
38
38
  async hedgeQuote :: Ticket -> Either Text Ticket
39
39
 
@@ -230,8 +230,8 @@ law "|a slow quote times out| is
230
230
  end example
231
231
  end law
232
232
 
233
- -- Quotes a ticket under a runtime with the real clock: whether it succeeded
234
- -- quickly (within 400ms), for ticket -2 through a hedged attempt.
233
+ -- Quotes a ticket under a runtime with the real clock: whether it succeeded,
234
+ -- for ticket -2 through a hedge that overtakes the stalled first attempt.
235
235
  async quoteHedged :: Int64 -> Bool
236
236
 
237
237
  law "|a stalled quote is hedged| is
@@ -2,12 +2,14 @@
2
2
  import { readFile, readdir, mkdir } from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { createCompiler } from "./api.mjs";
5
- import { targets } from "./templates.mjs";
5
+ import { programTargets as targets, artifactTargets } from "./templates.mjs";
6
6
  import { safePath, planWrites, applyWrites } from "./files.mjs";
7
7
  import { exportNativePayments } from "./native-examples.mjs";
8
8
 
9
9
  export async function generateExamples(options) {
10
10
  const selected = options.target ? [options.target] : targets;
11
+ if (selected.some(t => artifactTargets.includes(t)))
12
+ throw new Error("examples exports program targets; use init and generate for artifact targets");
11
13
  if (selected.some((t) => !targets.includes(t)))
12
14
  throw new Error(`Unknown target: ${options.target}`);
13
15
  if (options.example !== undefined) {
package/index.d.ts CHANGED
@@ -16,7 +16,12 @@ export type Target =
16
16
  'scala' |
17
17
  'groovy' |
18
18
  'clojure' |
19
- 'swift';
19
+ 'swift' |
20
+ 'prolog' |
21
+ 'hcl' |
22
+ 'yaml' |
23
+ 'antlr4' |
24
+ 'make';
20
25
 
21
26
  export interface Source {
22
27
  path: string;
@@ -25,6 +25,7 @@ export function recordNativeAttempts(run, tests, {keys,seed,ok,profile,output,al
25
25
  const model=(entry.obligations?.length??0)>0;
26
26
  const complete=matched.length>0&&matched.every(test=>test.status==='passed')&&(ok||model);
27
27
  const outcome=matched.some(test=>test.status==='failed')?'failed':
28
+ matched.some(test=>test.status==='incomplete')?'incomplete':
28
29
  entry.skip?'skipped':complete?(entry.knownFailing?'known-failing':'passed'):
29
30
  matched.length&&matched.every(test=>test.status==='skipped')?'skipped':'incomplete';
30
31
  return [entry.law,{key:keys.get(entry.law),planKey:entry.key,seed:nativeSeed(seed),at,outcome,
@@ -41,10 +42,16 @@ export function recordNativeAttempts(run, tests, {keys,seed,ok,profile,output,al
41
42
  }));
42
43
  }
43
44
 
45
+ // A law an attestation touches is keyed by how its dependencies were wired:
46
+ // endpoint, kind, and a stand-in's product, version and conformance. What the
47
+ // run observed (reached, history digests, completion) and the identities
48
+ // reported beside it are not inputs, so they change no key.
44
49
  export function attestedKeys(result) {
50
+ const wiring=d=>[d.dependency,d.endpoint,d.kind,
51
+ ...(d.standIn?[d.standIn.identity,d.standIn.version,d.standIn.conformance]:[])];
45
52
  return new Map((result.evidence??[]).filter(item=>item.against||item.plannedAgainst)
46
53
  .map(item=>[item.declaration,JSON.stringify([
47
- item.environment??item.plannedEnvironment,item.against??item.plannedAgainst])]));
54
+ item.environment??item.plannedEnvironment,(item.against??item.plannedAgainst).map(wiring)])]));
48
55
  }
49
56
 
50
57
  const subject = (entry,item) => obligationTargets(entry).some(target=>
@@ -60,17 +67,22 @@ export async function readNativeObservations({compiler,input,selected,roots,conf
60
67
  const record=JSON.parse(await readFile(file,'utf8').catch(error=>{
61
68
  if(error.code==='ENOENT')return '{}';throw error;
62
69
  }));
63
- return {target,root,attempts:record.attempts??{},runs:record.laws??{}};
70
+ return {target,root,attempts:record.attempts??{},runs:record.laws??{},attestations:record.attestations??{}};
64
71
  }));
65
72
  if(!records.some(record=>Object.keys(record.attempts).length))return [];
66
73
  const observations=[];
67
- for(const {target,root,attempts,runs}of records){
74
+ for(const {target,root,attempts,runs,attestations}of records){
68
75
  const plans=new Map(),contexts=new Map();
69
- async function plan(minify){
70
- if(!plans.has(minify))plans.set(minify,await compiler.planGeneration({...input,target:target.language,
76
+ // An attempt is keyed by the wiring of the attestation it ran under: the
77
+ // one named now, or else the one lawspec test stored for its run.
78
+ const wiredBy=attempt=>attestation??(attempt?.environment?attestations[attempt.environment]:undefined);
79
+ const slot=(minify,wired)=>`${minify}\0${wired?.run?.id??''}`;
80
+ async function plan(minify,wired=attestation){
81
+ const key=slot(minify,wired);
82
+ if(!plans.has(key))plans.set(key,await compiler.planGeneration({...input,target:target.language,
71
83
  sourceDir:target.sourceDir,testDir:target.testDir,nativeBindings:target.nativeBindings,minify,
72
- ...(attestation?{attestation}:{})}));
73
- return plans.get(minify);
84
+ ...(wired?{attestation:wired}:{})}));
85
+ return plans.get(key);
74
86
  }
75
87
  const modes=[...new Set(Object.values(attempts).map(attempt=>attempt.profile?.minify)
76
88
  .filter(mode=>typeof mode==='boolean'))];
@@ -83,9 +95,10 @@ export async function readNativeObservations({compiler,input,selected,roots,conf
83
95
  continue;
84
96
  }
85
97
  const expected=new Map(base.tests.map(entry=>[entry.law,entry]));
86
- async function context(minify){
87
- if(contexts.has(minify))return contexts.get(minify);
88
- const generated=await plan(minify);
98
+ async function context(minify,wired){
99
+ const key=slot(minify,wired);
100
+ if(contexts.has(key))return contexts.get(key);
101
+ const generated=await plan(minify,wired);
89
102
  let result;
90
103
  if(generated.diagnostics.length)result={reason:'Native generation is unavailable for the recorded layout'};
91
104
  else {
@@ -103,7 +116,7 @@ export async function readNativeObservations({compiler,input,selected,roots,conf
103
116
  }
104
117
  }
105
118
  }
106
- contexts.set(minify,result);return result;
119
+ contexts.set(key,result);return result;
107
120
  }
108
121
  for(const [id,baseline]of expected){
109
122
  const attempt=attempts[id];
@@ -115,7 +128,7 @@ export async function readNativeObservations({compiler,input,selected,roots,conf
115
128
  typeof profile.minify!=='boolean'){
116
129
  observations.push({...row,freshness:'stale',reason:'Compiler, target or machine profile differs'});continue;
117
130
  }
118
- const current=await context(profile.minify);
131
+ const current=await context(profile.minify,wiredBy(attempt));
119
132
  if(current.reason){observations.push({...row,freshness:current.stale?'stale':'unavailable',reason:current.reason});continue;}
120
133
  const entry=current.generated.tests.find(entry=>entry.law===id);
121
134
  if(!entry||attempt.key!==current.keys.get(id)||attempt.planKey!==entry.key||
@@ -46,7 +46,7 @@ archive preserves distinct present and absent payments.
46
46
 
47
47
  The specification uses the canonical language profile. The version 2 project
48
48
  configuration selects its verification layers explicitly. Most targets bind
49
- application-owned domain types; C# and Clojure use the generated model data
49
+ application-owned domain types; C#, Clojure and Prolog use the generated model data
50
50
  and bind the application's functions and generators.
51
51
 
52
52
  ## Run
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lawspec",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "State the law once. Check it everywhere.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -37,6 +37,7 @@
37
37
  "CHANGELOG.md",
38
38
  "LICENSE",
39
39
  "UNICODE-LICENSE.txt",
40
+ "NORMALIZATION-LICENSES.txt",
40
41
  "starter.lawspec",
41
42
  "starter-rc1.lawspec",
42
43
  "examples"
package/templates.mjs CHANGED
@@ -18,8 +18,39 @@ export const targets = [
18
18
  "scala",
19
19
  "groovy",
20
20
  "clojure",
21
- "swift"
21
+ "swift",
22
+ "prolog",
23
+ "hcl",
24
+ "yaml",
25
+ "antlr4",
26
+ "make"
22
27
  ];
28
+ export const programTargets = [
29
+ "java",
30
+ "python",
31
+ "javascript",
32
+ "typescript",
33
+ "go",
34
+ "haskell",
35
+ "kotlin",
36
+ "rust",
37
+ "erlang",
38
+ "elixir",
39
+ "gleam",
40
+ "fsharp",
41
+ "csharp",
42
+ "scala",
43
+ "groovy",
44
+ "clojure",
45
+ "swift",
46
+ "prolog"
47
+ ];
48
+ export const artifactTargets = [
49
+ "hcl",
50
+ "yaml",
51
+ "antlr4",
52
+ "make"
53
+ ];
23
54
  export const targetLabels = [
24
55
  [
25
56
  "java",
@@ -88,6 +119,26 @@ export const targetLabels = [
88
119
  [
89
120
  "swift",
90
121
  "Swift"
122
+ ],
123
+ [
124
+ "prolog",
125
+ "Prolog"
126
+ ],
127
+ [
128
+ "hcl",
129
+ "HCL"
130
+ ],
131
+ [
132
+ "yaml",
133
+ "YAML"
134
+ ],
135
+ [
136
+ "antlr4",
137
+ "ANTLR"
138
+ ],
139
+ [
140
+ "make",
141
+ "Make"
91
142
  ]
92
143
  ];
93
144
 
@@ -108,7 +159,8 @@ export const commands = {
108
159
  "scala": "scala test .",
109
160
  "groovy": "gradle test",
110
161
  "clojure": "clojure -M:test",
111
- "swift": "swift test"
162
+ "swift": "swift test",
163
+ "prolog": "python lawspec_test.py"
112
164
  };
113
165
 
114
166
  export const setup = {
@@ -128,7 +180,12 @@ export const setup = {
128
180
  "scala": "Use JDK 25 and Scala CLI 1.16 (the scala command), with Scala 3.9.0, ScalaCheck 1.20.0 and ScalaTest 3.2.20 (scalatest-funsuite) as test dependencies in project.scala; a program that imports lawspec.crypto or lawspec.network also needs Bouncy Castle bcprov-jdk18on 1.86. Run scala compile --test .",
129
181
  "groovy": "Use JDK 25, Gradle 9.3.0 with the groovy plugin, Groovy 5.0.8 (org.apache.groovy:groovy), Spock 2.5-groovy-5.0, JetCheck 0.3.0 and JUnit Jupiter's API 5.14.0, and useJUnitPlatform(); the Java model compiles jointly with the Groovy sources, so src/main/java and src/test/java are Groovy source directories. A program that imports lawspec.crypto or lawspec.network also needs Bouncy Castle bcprov-jdk18on 1.86. Run gradle testClasses.",
130
182
  "clojure": "Use JDK 25 and the Clojure CLI 1.12 with Clojure 1.12.5 and, for tests, test.check 1.1.3 (the :test alias). The Java model in java/src compiles with the JDK's compiler into target/classes, which lawspec.build does before the tests run (clojure -M:build compiles it alone). A program that imports lawspec.crypto or lawspec.network also needs Bouncy Castle bcprov-jdk18on 1.86. Run clojure -M:test.",
131
- "swift": "Use Swift 6.2 or later (Xcode 26 on macOS 26, where CryptoKit has ML-KEM and ML-DSA) and SwiftPM. The generated runtime and test support are local targets under lawspec/ with no package dependencies; tests run on Swift Testing, from the toolchain, with LawSpec's own property engine. Package.swift declares the targets LawSpecRuntime, LawSpecTesting, App (src) and AppTests (tests), as lawspec init writes it. Run swift build --build-tests."
183
+ "swift": "Use Swift 6.2 or later (Xcode 26 on macOS 26, where CryptoKit has ML-KEM and ML-DSA) and SwiftPM. The generated runtime and test support are local targets under lawspec/ with no package dependencies; tests run on Swift Testing, from the toolchain, with LawSpec's own property engine. Package.swift declares the targets LawSpecRuntime, LawSpecTesting, App (src) and AppTests (tests), as lawspec init writes it. Run swift build --build-tests.",
184
+ "prolog": "Use SWI-Prolog 10.0+ and Python 3.13+ with janus-swi 1.5.3, pytest 8.4.x and Hypothesis 6.x. Install the generated project with python -m pip install -e \".[test]\". Run python lawspec_test.py (PLUnit with the checked Python model), or lawspec test. Set the target python field to the selected interpreter.",
185
+ "hcl": "Generate Terraform variables and checked tfvars using lawspec generate. Run tofu init -backend=false, tofu validate and tofu plan -var-file=configuration.tfvars.json. Artifact generation does not execute application laws.",
186
+ "yaml": "Generate YAML 1.2 configuration and a JSON Schema 2020-12 schema using lawspec generate. Validate edited YAML with a JSON Schema validator. Artifact generation does not execute application laws.",
187
+ "antlr4": "Compile LawSpecData.g4 with ANTLR 4. The grammar checks data syntax; numeric ranges and field predicates require the companion JSON Schema after decoding. Artifact generation does not execute application laws.",
188
+ "make": "Run make to check the project, generate its configured targets and execute its program target tests using the installed lawspec CLI."
132
189
  };
133
190
 
134
191
  // Each target's build files in the readable and the compact (minified) layout.
@@ -304,6 +361,30 @@ const scaffolds = {
304
361
  "compact": {
305
362
  "Package.swift": "// swift-tools-version: 6.2\nimport PackageDescription\nlet package = Package(\n name: \"Example\",\n platforms: [.macOS(.v26)],\n targets: [\n .target(name: \"LawSpecRuntime\", path: \"lawspec/LawSpecRuntime\"),\n .target(name: \"LawSpecTesting\", dependencies: [\"LawSpecRuntime\"], path: \"lawspec/LawSpecTesting\"),\n .target(name: \"App\", dependencies: [\"LawSpecRuntime\"], path: \"src\"),\n .testTarget(name: \"AppTests\", dependencies: [\"App\", \"LawSpecRuntime\", \"LawSpecTesting\"], path: \"tests\"),\n ]\n)\n"
306
363
  }
364
+ },
365
+ "prolog": {
366
+ "readable": {
367
+ "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 = [\"janus-swi==1.5.3\"]\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"
368
+ },
369
+ "compact": {
370
+ "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 = [\"janus-swi==1.5.3\"]\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"
371
+ }
372
+ },
373
+ "hcl": {
374
+ "readable": {},
375
+ "compact": {}
376
+ },
377
+ "yaml": {
378
+ "readable": {},
379
+ "compact": {}
380
+ },
381
+ "antlr4": {
382
+ "readable": {},
383
+ "compact": {}
384
+ },
385
+ "make": {
386
+ "readable": {},
387
+ "compact": {}
307
388
  }
308
389
  };
309
390
 
package/test-command.mjs CHANGED
@@ -29,7 +29,22 @@ const digest = (value) => createHash("sha256").update(value).digest("hex");
29
29
  // contribute to the adapter digest; rebuilding the NIF cannot invalidate a pass.
30
30
  const cryptoBuildOutput = (file) => /^priv\/lawspec_crypto_native\.(?:so|dll)(?:\.build|\.\d+\.tmp)?$/.test(file);
31
31
 
32
- // Every file in a project that LawSpec did not generate, by content.
32
+ // An environment attestation records where a run's dependencies were wired
33
+ // and what was observed; it is reporting only, never an input of the
34
+ // project, so one written inside the project is not digested. It is known by
35
+ // its content, whatever its name or whichever tool wrote it.
36
+ // ref:DEC-completed-run-attestation
37
+ export function isAttestation(content) {
38
+ try {
39
+ const value = JSON.parse(content);
40
+ return value !== null && typeof value === "object" && value.format === "environment-attestation";
41
+ } catch {
42
+ return false;
43
+ }
44
+ }
45
+
46
+ // Every file in a project that LawSpec did not generate, by content, except
47
+ // environment attestations.
33
48
  export async function projectDigest(root, generated) {
34
49
  const hash = createHash("sha256");
35
50
  async function walk(folder) {
@@ -40,7 +55,9 @@ export async function projectDigest(root, generated) {
40
55
  if (entry.isDirectory()) {
41
56
  if (!skipped.has(entry.name) && !relative.endsWith("testdata/rapid")) await walk(relative);
42
57
  } else if (entry.isFile() && !generated.has(relative) && !cryptoBuildOutput(relative)) {
43
- hash.update(relative + "\0").update(await readFile(path.join(root, relative))).update("\0");
58
+ const content = await readFile(path.join(root, relative));
59
+ if (relative.endsWith(".json") && isAttestation(content.toString("utf8"))) continue;
60
+ hash.update(relative + "\0").update(content).update("\0");
44
61
  }
45
62
  }
46
63
  }
@@ -121,6 +138,9 @@ export function preparationInvocations(target, files) {
121
138
  export function benchmarkInvocations(target, entries, { offline = false } = {}) {
122
139
  if (!entries.length) return [];
123
140
  const language = target.language;
141
+ if (language === "prolog")
142
+ return [{command: target.python || "python3", args: ["lawspec_test.py",
143
+ ...entries.flatMap(entry => ["--select", `${entry.file}::${entry.name}`])]}];
124
144
  const testDir = target.testDir;
125
145
  const relativeTo = (file, defaultDir) => {
126
146
  const directory = testDir || defaultDir;
@@ -214,6 +234,16 @@ function nativeInvocations(target, entries, { offline = false, scratch = ".", co
214
234
  root = process.cwd(), coverageConfig } = {}) {
215
235
  if (!entries.length) return [];
216
236
  const language = target.language;
237
+ if (language === "prolog") {
238
+ if (coverage) throw new Error("Prolog coverage instrumentation is not integrated");
239
+ const report = path.join(scratch, "prolog.xml");
240
+ const matching = test => entries.filter(entry => entry.kind === "model"
241
+ ? test.name === entry.name : test.name.startsWith(`${entry.name}__`));
242
+ const selections = [...new Set(entries.map(entry => `${entry.file}::${entry.name}`))];
243
+ return [{laws: entries, command: target.python || "python3",
244
+ args: ["lawspec_test.py", ...selections.flatMap(slot => ["--select", slot]), "--junitxml", report],
245
+ report: {kind: "junit", files: [report]}, ran: matching}];
246
+ }
217
247
  const testDir = target.testDir;
218
248
  const relativeTo = (file, defaultDir) => {
219
249
  const directory = testDir || defaultDir;
@@ -587,7 +617,11 @@ export async function executedTests(report, output, root, since) {
587
617
  const values=attributes(element.opening);
588
618
  const native=junitElements(element.xml,["failure","error","skipped"]);
589
619
  const failure=native.filter(element=>element.name!=="skipped");
590
- const status=failure.length?"failed":native.length?"skipped":"passed";
620
+ const incomplete=junitElements(element.xml,["property"]).some(property=>{
621
+ const value=attributes(property.opening);
622
+ return value.name==='lawspec.status'&&value.value==='incomplete';
623
+ });
624
+ const status=incomplete?"incomplete":failure.length?"failed":native.length?"skipped":"passed";
591
625
  const detail=element=>[attributes(element.opening).message,
592
626
  unescapeXml(element.xml.slice(element.opening.length).replace(/<\/(failure|error|skipped)>\s*$/,"")
593
627
  .replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g,(_,text)=>text))].filter(Boolean).join("\n");
@@ -631,6 +665,7 @@ export async function executedTests(report, output, root, since) {
631
665
  // JUnit XML for a runner that writes none, from the tests it printed.
632
666
  export function junitFromTests(tests) {
633
667
  const failures = tests.filter((t) => t.status === "failed").length;
668
+ const errors = tests.filter((t) => t.status === "incomplete").length;
634
669
  const skipped = tests.filter((t) => t.status === "skipped").length;
635
670
  // A BEAM scheduler wraps native functions from several units. Its module
636
671
  // is not the declaring class: retain the unit from the validated identity.
@@ -638,10 +673,11 @@ export function junitFromTests(tests) {
638
673
  const separator = typeof test.identity === "string" ? test.identity.lastIndexOf("::") : -1;
639
674
  return separator > 0 ? test.identity.slice(0, separator) : test.classname ?? "";
640
675
  };
641
- return `<testsuite name="lawspec" tests="${tests.length}" failures="${failures}"${skipped ? ` skipped="${skipped}"` : ""}>\n` +
676
+ return `<testsuite name="lawspec" tests="${tests.length}" failures="${failures}"${errors ? ` errors="${errors}"` : ""}${skipped ? ` skipped="${skipped}"` : ""}>\n` +
642
677
  tests.map((t) => ` <testcase classname="${escapeXml(classname(t))}" name="${escapeXml(t.name)}"` +
643
678
  (Number.isFinite(t.time) ? ` time="${t.time}"` : "") +
644
679
  (t.status === "failed" ? `><failure message="${escapeXml(t.failure ?? "failed")}"/></testcase>` :
680
+ t.status === "incomplete" ? `><properties><property name="lawspec.status" value="incomplete"/></properties><error message="${escapeXml(t.failure ?? t.reason ?? "incomplete execution")}"/></testcase>` :
645
681
  t.status === "skipped" ? `><skipped message="${escapeXml(t.reason ?? "skipped")}"/></testcase>` : "/>")).join("\n") + "\n</testsuite>";
646
682
  }
647
683