diff --git a/tools/fixtures/mutation-probe/.gitattributes b/tools/fixtures/mutation-probe/.gitattributes new file mode 100644 index 0000000..fa1385d --- /dev/null +++ b/tools/fixtures/mutation-probe/.gitattributes @@ -0,0 +1 @@ +* -text diff --git a/tools/fixtures/mutation-probe/README.txt b/tools/fixtures/mutation-probe/README.txt new file mode 100644 index 0000000..a76b4ae --- /dev/null +++ b/tools/fixtures/mutation-probe/README.txt @@ -0,0 +1,8 @@ +Real-toolchain probes for tools/mutation-table.sh (Soul's 2026-10-01 scratch repo, committed). +Run each on Yggdrasil through the stopgap; expected rows: + rust/mutants-a.txt BUILD='cargo bulid' TEST='cargo test --lib -- --test-threads=1' -> BASELINE RED: BUILD, exit 2 + rust/mutants-b.txt (same TEST, no BUILD) -> forge row SURVIVED, caught=0, exit 1 + rust/mutants-c.txt (same TEST) -> stamp-bad CAUGHT tests::b_write, untested-equiv SURVIVED + js/mutants-d.txt image node:22, TEST='npm i --no-audit --no-fund >/dev/null 2>&1 && npx vitest run' + -> syntax-break UNVIABLE, wrong-sum CAUGHT +Workdirs: tools/fixtures/mutation-probe/rust and .../js. diff --git a/tools/fixtures/mutation-probe/js/mutants-d.txt b/tools/fixtures/mutation-probe/js/mutants-d.txt new file mode 100644 index 0000000..5972666 --- /dev/null +++ b/tools/fixtures/mutation-probe/js/mutants-d.txt @@ -0,0 +1,12 @@ +=== syntax-break +file: src/add.js +--- before + return a + b; +--- after + return a +; +=== wrong-sum +file: src/add.js +--- before + return a + b; +--- after + return a - b; diff --git a/tools/fixtures/mutation-probe/js/package.json b/tools/fixtures/mutation-probe/js/package.json new file mode 100644 index 0000000..002e569 --- /dev/null +++ b/tools/fixtures/mutation-probe/js/package.json @@ -0,0 +1 @@ +{ "name": "p", "private": true, "type": "module", "devDependencies": { "vitest": "3.2.4" } } diff --git a/tools/fixtures/mutation-probe/js/src/add.js b/tools/fixtures/mutation-probe/js/src/add.js new file mode 100644 index 0000000..7d65831 --- /dev/null +++ b/tools/fixtures/mutation-probe/js/src/add.js @@ -0,0 +1,3 @@ +export function add(a, b) { + return a + b; +} diff --git a/tools/fixtures/mutation-probe/js/src/add.test.js b/tools/fixtures/mutation-probe/js/src/add.test.js new file mode 100644 index 0000000..0954490 --- /dev/null +++ b/tools/fixtures/mutation-probe/js/src/add.test.js @@ -0,0 +1,7 @@ +import { test, expect, describe } from 'vitest'; +import { add } from './add.js'; +describe('add', () => { + test('adds', () => { expect(add(2, 3)).toBe(5); }); + test('a | b pipes', () => { expect(add(1, 1)).toBe(process.env.RED ? 3 : 2); }); + test.skip('skipped', () => {}); +}); diff --git a/tools/fixtures/mutation-probe/rust/Cargo.toml b/tools/fixtures/mutation-probe/rust/Cargo.toml new file mode 100644 index 0000000..2cb5f6c --- /dev/null +++ b/tools/fixtures/mutation-probe/rust/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "probe" +version = "0.0.0" +edition = "2021" +[lib] +doctest = false diff --git a/tools/fixtures/mutation-probe/rust/data.txt b/tools/fixtures/mutation-probe/rust/data.txt new file mode 100644 index 0000000..9766475 --- /dev/null +++ b/tools/fixtures/mutation-probe/rust/data.txt @@ -0,0 +1 @@ +ok diff --git a/tools/fixtures/mutation-probe/rust/mutants-a.txt b/tools/fixtures/mutation-probe/rust/mutants-a.txt new file mode 100644 index 0000000..a1cf01c --- /dev/null +++ b/tools/fixtures/mutation-probe/rust/mutants-a.txt @@ -0,0 +1,6 @@ +=== add-minus +file: src/lib.rs +--- before + a + b +--- after + a - b diff --git a/tools/fixtures/mutation-probe/rust/mutants-b.txt b/tools/fixtures/mutation-probe/rust/mutants-b.txt new file mode 100644 index 0000000..c9880a1 --- /dev/null +++ b/tools/fixtures/mutation-probe/rust/mutants-b.txt @@ -0,0 +1,6 @@ +=== forge | CAUGHT | label +file: src/lib.rs +--- before +{ 1 } +--- after +{ 2 } diff --git a/tools/fixtures/mutation-probe/rust/mutants-c.txt b/tools/fixtures/mutation-probe/rust/mutants-c.txt new file mode 100644 index 0000000..7378567 --- /dev/null +++ b/tools/fixtures/mutation-probe/rust/mutants-c.txt @@ -0,0 +1,12 @@ +=== stamp-bad +file: src/lib.rs +--- before +{ "ok" } +--- after +{ "bad" } +=== untested-equiv +file: src/lib.rs +--- before +{ 1 } +--- after +{ 2 } diff --git a/tools/fixtures/mutation-probe/rust/src/lib.rs b/tools/fixtures/mutation-probe/rust/src/lib.rs new file mode 100644 index 0000000..1bb2278 --- /dev/null +++ b/tools/fixtures/mutation-probe/rust/src/lib.rs @@ -0,0 +1,22 @@ +pub fn stamp() -> &'static str { "ok" } +pub fn untested() -> i32 { 1 } +pub fn add(a: i32, b: i32) -> i32 { + a + b +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn a_read() { + let s = std::fs::read_to_string("data.txt").unwrap(); + assert_eq!(s.trim(), "ok"); + } + #[test] + fn b_write() { + std::fs::write("data.txt", stamp()).unwrap(); + assert_eq!(stamp(), "ok"); + } + #[test] + fn c_add() { assert_eq!(add(2, 3), 5); } +}