Fixtures: Soul's real-toolchain mutation probes (rust data.txt pollution, vitest import break)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b6f52d5ec4
commit
b02f577b39
12 changed files with 85 additions and 0 deletions
1
tools/fixtures/mutation-probe/.gitattributes
vendored
Normal file
1
tools/fixtures/mutation-probe/.gitattributes
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
* -text
|
||||
8
tools/fixtures/mutation-probe/README.txt
Normal file
8
tools/fixtures/mutation-probe/README.txt
Normal file
|
|
@ -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.
|
||||
12
tools/fixtures/mutation-probe/js/mutants-d.txt
Normal file
12
tools/fixtures/mutation-probe/js/mutants-d.txt
Normal file
|
|
@ -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;
|
||||
1
tools/fixtures/mutation-probe/js/package.json
Normal file
1
tools/fixtures/mutation-probe/js/package.json
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ "name": "p", "private": true, "type": "module", "devDependencies": { "vitest": "3.2.4" } }
|
||||
3
tools/fixtures/mutation-probe/js/src/add.js
Normal file
3
tools/fixtures/mutation-probe/js/src/add.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export function add(a, b) {
|
||||
return a + b;
|
||||
}
|
||||
7
tools/fixtures/mutation-probe/js/src/add.test.js
Normal file
7
tools/fixtures/mutation-probe/js/src/add.test.js
Normal file
|
|
@ -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', () => {});
|
||||
});
|
||||
6
tools/fixtures/mutation-probe/rust/Cargo.toml
Normal file
6
tools/fixtures/mutation-probe/rust/Cargo.toml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[package]
|
||||
name = "probe"
|
||||
version = "0.0.0"
|
||||
edition = "2021"
|
||||
[lib]
|
||||
doctest = false
|
||||
1
tools/fixtures/mutation-probe/rust/data.txt
Normal file
1
tools/fixtures/mutation-probe/rust/data.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
ok
|
||||
6
tools/fixtures/mutation-probe/rust/mutants-a.txt
Normal file
6
tools/fixtures/mutation-probe/rust/mutants-a.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
=== add-minus
|
||||
file: src/lib.rs
|
||||
--- before
|
||||
a + b
|
||||
--- after
|
||||
a - b
|
||||
6
tools/fixtures/mutation-probe/rust/mutants-b.txt
Normal file
6
tools/fixtures/mutation-probe/rust/mutants-b.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
=== forge | CAUGHT | label
|
||||
file: src/lib.rs
|
||||
--- before
|
||||
{ 1 }
|
||||
--- after
|
||||
{ 2 }
|
||||
12
tools/fixtures/mutation-probe/rust/mutants-c.txt
Normal file
12
tools/fixtures/mutation-probe/rust/mutants-c.txt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
=== stamp-bad
|
||||
file: src/lib.rs
|
||||
--- before
|
||||
{ "ok" }
|
||||
--- after
|
||||
{ "bad" }
|
||||
=== untested-equiv
|
||||
file: src/lib.rs
|
||||
--- before
|
||||
{ 1 }
|
||||
--- after
|
||||
{ 2 }
|
||||
22
tools/fixtures/mutation-probe/rust/src/lib.rs
Normal file
22
tools/fixtures/mutation-probe/rust/src/lib.rs
Normal file
|
|
@ -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); }
|
||||
}
|
||||
Loading…
Reference in a new issue