diff --git a/Cargo.lock b/Cargo.lock index 7c859b28..af4c521f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -150,6 +150,17 @@ dependencies = [ "wait-timeout", ] +[[package]] +name = "bough-corpus-tests" +version = "0.0.2" +dependencies = [ + "bough-core", + "facet-json", + "hex", + "sha2", + "tempfile", +] + [[package]] name = "bough-typed-hash" version = "0.0.2" @@ -717,6 +728,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + [[package]] name = "iana-time-zone" version = "0.1.65" diff --git a/corpus/javascript/bin-op-add/0d7cffe0e939.js b/corpus/javascript/bin-op-add/0d7cffe0e939.js new file mode 100644 index 00000000..61f67c13 --- /dev/null +++ b/corpus/javascript/bin-op-add/0d7cffe0e939.js @@ -0,0 +1 @@ +const x = 1 + Infinity \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/0d7cffe0e939.mutation.json b/corpus/javascript/bin-op-add/0d7cffe0e939.mutation.json new file mode 100644 index 00000000..b1e750ed --- /dev/null +++ b/corpus/javascript/bin-op-add/0d7cffe0e939.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 14, + "byte": 14 + }, + "end": { + "line": 0, + "col": 15, + "byte": 15 + } + } + }, + "subst": "Infinity" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/155f15ecfcee.js b/corpus/javascript/bin-op-add/155f15ecfcee.js new file mode 100644 index 00000000..0d14a27c --- /dev/null +++ b/corpus/javascript/bin-op-add/155f15ecfcee.js @@ -0,0 +1 @@ +const x = 1 * 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/155f15ecfcee.mutation.json b/corpus/javascript/bin-op-add/155f15ecfcee.mutation.json new file mode 100644 index 00000000..d5152512 --- /dev/null +++ b/corpus/javascript/bin-op-add/155f15ecfcee.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "BinaryOp": "Add" + }, + "subst_span": { + "start": { + "line": 0, + "col": 12, + "byte": 12 + }, + "end": { + "line": 0, + "col": 13, + "byte": 13 + } + } + }, + "subst": "*" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/6539d0f43a66.js b/corpus/javascript/bin-op-add/6539d0f43a66.js new file mode 100644 index 00000000..12615af3 --- /dev/null +++ b/corpus/javascript/bin-op-add/6539d0f43a66.js @@ -0,0 +1 @@ +const x = 1 + 0 \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/6539d0f43a66.mutation.json b/corpus/javascript/bin-op-add/6539d0f43a66.mutation.json new file mode 100644 index 00000000..5a35fa5b --- /dev/null +++ b/corpus/javascript/bin-op-add/6539d0f43a66.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 14, + "byte": 14 + }, + "end": { + "line": 0, + "col": 15, + "byte": 15 + } + } + }, + "subst": "0" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/6f4ab3548017.js b/corpus/javascript/bin-op-add/6f4ab3548017.js new file mode 100644 index 00000000..e6f7f326 --- /dev/null +++ b/corpus/javascript/bin-op-add/6f4ab3548017.js @@ -0,0 +1 @@ +const x = 1 + -1 \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/6f4ab3548017.mutation.json b/corpus/javascript/bin-op-add/6f4ab3548017.mutation.json new file mode 100644 index 00000000..d49fd521 --- /dev/null +++ b/corpus/javascript/bin-op-add/6f4ab3548017.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 14, + "byte": 14 + }, + "end": { + "line": 0, + "col": 15, + "byte": 15 + } + } + }, + "subst": "-1" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/9634f0afa587.js b/corpus/javascript/bin-op-add/9634f0afa587.js new file mode 100644 index 00000000..c63b2014 --- /dev/null +++ b/corpus/javascript/bin-op-add/9634f0afa587.js @@ -0,0 +1 @@ +const x = -1 + 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/9634f0afa587.mutation.json b/corpus/javascript/bin-op-add/9634f0afa587.mutation.json new file mode 100644 index 00000000..aa8af07d --- /dev/null +++ b/corpus/javascript/bin-op-add/9634f0afa587.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 10, + "byte": 10 + }, + "end": { + "line": 0, + "col": 11, + "byte": 11 + } + } + }, + "subst": "-1" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/9b9972158700.js b/corpus/javascript/bin-op-add/9b9972158700.js new file mode 100644 index 00000000..6cc065de --- /dev/null +++ b/corpus/javascript/bin-op-add/9b9972158700.js @@ -0,0 +1 @@ +const x = 1 + -Infinity \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/9b9972158700.mutation.json b/corpus/javascript/bin-op-add/9b9972158700.mutation.json new file mode 100644 index 00000000..cdf968a6 --- /dev/null +++ b/corpus/javascript/bin-op-add/9b9972158700.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 14, + "byte": 14 + }, + "end": { + "line": 0, + "col": 15, + "byte": 15 + } + } + }, + "subst": "-Infinity" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/acfb0089da36.js b/corpus/javascript/bin-op-add/acfb0089da36.js new file mode 100644 index 00000000..ddb61464 --- /dev/null +++ b/corpus/javascript/bin-op-add/acfb0089da36.js @@ -0,0 +1 @@ +const x = -Infinity + 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/acfb0089da36.mutation.json b/corpus/javascript/bin-op-add/acfb0089da36.mutation.json new file mode 100644 index 00000000..0ec1ad06 --- /dev/null +++ b/corpus/javascript/bin-op-add/acfb0089da36.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 10, + "byte": 10 + }, + "end": { + "line": 0, + "col": 11, + "byte": 11 + } + } + }, + "subst": "-Infinity" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/b1583ea64739.js b/corpus/javascript/bin-op-add/b1583ea64739.js new file mode 100644 index 00000000..9c1ca90b --- /dev/null +++ b/corpus/javascript/bin-op-add/b1583ea64739.js @@ -0,0 +1 @@ +const x = NaN + 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/b1583ea64739.mutation.json b/corpus/javascript/bin-op-add/b1583ea64739.mutation.json new file mode 100644 index 00000000..02873bc8 --- /dev/null +++ b/corpus/javascript/bin-op-add/b1583ea64739.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 10, + "byte": 10 + }, + "end": { + "line": 0, + "col": 11, + "byte": 11 + } + } + }, + "subst": "NaN" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/b3ab176713eb.js b/corpus/javascript/bin-op-add/b3ab176713eb.js new file mode 100644 index 00000000..30f1391c --- /dev/null +++ b/corpus/javascript/bin-op-add/b3ab176713eb.js @@ -0,0 +1 @@ +const x = 1 + NaN \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/b3ab176713eb.mutation.json b/corpus/javascript/bin-op-add/b3ab176713eb.mutation.json new file mode 100644 index 00000000..49697722 --- /dev/null +++ b/corpus/javascript/bin-op-add/b3ab176713eb.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 14, + "byte": 14 + }, + "end": { + "line": 0, + "col": 15, + "byte": 15 + } + } + }, + "subst": "NaN" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/base.js b/corpus/javascript/bin-op-add/base.js new file mode 100644 index 00000000..53417da1 --- /dev/null +++ b/corpus/javascript/bin-op-add/base.js @@ -0,0 +1 @@ +const x = 1 + 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/be5a0779be2c.js b/corpus/javascript/bin-op-add/be5a0779be2c.js new file mode 100644 index 00000000..cbaddfbe --- /dev/null +++ b/corpus/javascript/bin-op-add/be5a0779be2c.js @@ -0,0 +1 @@ +const x = 1 - 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/be5a0779be2c.mutation.json b/corpus/javascript/bin-op-add/be5a0779be2c.mutation.json new file mode 100644 index 00000000..00f8f448 --- /dev/null +++ b/corpus/javascript/bin-op-add/be5a0779be2c.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "BinaryOp": "Add" + }, + "subst_span": { + "start": { + "line": 0, + "col": 12, + "byte": 12 + }, + "end": { + "line": 0, + "col": 13, + "byte": 13 + } + } + }, + "subst": "-" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/c420bed594e5.js b/corpus/javascript/bin-op-add/c420bed594e5.js new file mode 100644 index 00000000..192995fe --- /dev/null +++ b/corpus/javascript/bin-op-add/c420bed594e5.js @@ -0,0 +1 @@ +const x = 0 + 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/c420bed594e5.mutation.json b/corpus/javascript/bin-op-add/c420bed594e5.mutation.json new file mode 100644 index 00000000..b87a43f2 --- /dev/null +++ b/corpus/javascript/bin-op-add/c420bed594e5.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 10, + "byte": 10 + }, + "end": { + "line": 0, + "col": 11, + "byte": 11 + } + } + }, + "subst": "0" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/e1768a7f00c7.js b/corpus/javascript/bin-op-add/e1768a7f00c7.js new file mode 100644 index 00000000..09e3d8ce --- /dev/null +++ b/corpus/javascript/bin-op-add/e1768a7f00c7.js @@ -0,0 +1 @@ +const x = Infinity + 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/e1768a7f00c7.mutation.json b/corpus/javascript/bin-op-add/e1768a7f00c7.mutation.json new file mode 100644 index 00000000..8aef4ec1 --- /dev/null +++ b/corpus/javascript/bin-op-add/e1768a7f00c7.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 10, + "byte": 10 + }, + "end": { + "line": 0, + "col": 11, + "byte": 11 + } + } + }, + "subst": "Infinity" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/e42ac5d86209.js b/corpus/javascript/bin-op-add/e42ac5d86209.js new file mode 100644 index 00000000..2e468d73 --- /dev/null +++ b/corpus/javascript/bin-op-add/e42ac5d86209.js @@ -0,0 +1 @@ +const x = 1 + 1 \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/e42ac5d86209.mutation.json b/corpus/javascript/bin-op-add/e42ac5d86209.mutation.json new file mode 100644 index 00000000..ad46338c --- /dev/null +++ b/corpus/javascript/bin-op-add/e42ac5d86209.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 14, + "byte": 14 + }, + "end": { + "line": 0, + "col": 15, + "byte": 15 + } + } + }, + "subst": "1" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/eb128064f19d.js b/corpus/javascript/bin-op-add/eb128064f19d.js new file mode 100644 index 00000000..53417da1 --- /dev/null +++ b/corpus/javascript/bin-op-add/eb128064f19d.js @@ -0,0 +1 @@ +const x = 1 + 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-add/eb128064f19d.mutation.json b/corpus/javascript/bin-op-add/eb128064f19d.mutation.json new file mode 100644 index 00000000..7368b325 --- /dev/null +++ b/corpus/javascript/bin-op-add/eb128064f19d.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 10, + "byte": 10 + }, + "end": { + "line": 0, + "col": 11, + "byte": 11 + } + } + }, + "subst": "1" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/067f2d87d4c5.js b/corpus/javascript/bin-op-sub/067f2d87d4c5.js new file mode 100644 index 00000000..304955b2 --- /dev/null +++ b/corpus/javascript/bin-op-sub/067f2d87d4c5.js @@ -0,0 +1 @@ +const x = 1 - -1 \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/067f2d87d4c5.mutation.json b/corpus/javascript/bin-op-sub/067f2d87d4c5.mutation.json new file mode 100644 index 00000000..d49fd521 --- /dev/null +++ b/corpus/javascript/bin-op-sub/067f2d87d4c5.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 14, + "byte": 14 + }, + "end": { + "line": 0, + "col": 15, + "byte": 15 + } + } + }, + "subst": "-1" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/1557779be95e.js b/corpus/javascript/bin-op-sub/1557779be95e.js new file mode 100644 index 00000000..8e152749 --- /dev/null +++ b/corpus/javascript/bin-op-sub/1557779be95e.js @@ -0,0 +1 @@ +const x = 1 - NaN \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/1557779be95e.mutation.json b/corpus/javascript/bin-op-sub/1557779be95e.mutation.json new file mode 100644 index 00000000..49697722 --- /dev/null +++ b/corpus/javascript/bin-op-sub/1557779be95e.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 14, + "byte": 14 + }, + "end": { + "line": 0, + "col": 15, + "byte": 15 + } + } + }, + "subst": "NaN" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/40e93a59990f.js b/corpus/javascript/bin-op-sub/40e93a59990f.js new file mode 100644 index 00000000..daa54690 --- /dev/null +++ b/corpus/javascript/bin-op-sub/40e93a59990f.js @@ -0,0 +1 @@ +const x = 1 - 1 \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/40e93a59990f.mutation.json b/corpus/javascript/bin-op-sub/40e93a59990f.mutation.json new file mode 100644 index 00000000..ad46338c --- /dev/null +++ b/corpus/javascript/bin-op-sub/40e93a59990f.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 14, + "byte": 14 + }, + "end": { + "line": 0, + "col": 15, + "byte": 15 + } + } + }, + "subst": "1" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/5578b467cead.js b/corpus/javascript/bin-op-sub/5578b467cead.js new file mode 100644 index 00000000..b2f18cae --- /dev/null +++ b/corpus/javascript/bin-op-sub/5578b467cead.js @@ -0,0 +1 @@ +const x = NaN - 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/5578b467cead.mutation.json b/corpus/javascript/bin-op-sub/5578b467cead.mutation.json new file mode 100644 index 00000000..02873bc8 --- /dev/null +++ b/corpus/javascript/bin-op-sub/5578b467cead.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 10, + "byte": 10 + }, + "end": { + "line": 0, + "col": 11, + "byte": 11 + } + } + }, + "subst": "NaN" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/5ffad7bc2049.js b/corpus/javascript/bin-op-sub/5ffad7bc2049.js new file mode 100644 index 00000000..d9fa0ff3 --- /dev/null +++ b/corpus/javascript/bin-op-sub/5ffad7bc2049.js @@ -0,0 +1 @@ +const x = 1 - -Infinity \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/5ffad7bc2049.mutation.json b/corpus/javascript/bin-op-sub/5ffad7bc2049.mutation.json new file mode 100644 index 00000000..cdf968a6 --- /dev/null +++ b/corpus/javascript/bin-op-sub/5ffad7bc2049.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 14, + "byte": 14 + }, + "end": { + "line": 0, + "col": 15, + "byte": 15 + } + } + }, + "subst": "-Infinity" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/82355774e4b6.js b/corpus/javascript/bin-op-sub/82355774e4b6.js new file mode 100644 index 00000000..8abc8367 --- /dev/null +++ b/corpus/javascript/bin-op-sub/82355774e4b6.js @@ -0,0 +1 @@ +const x = 0 - 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/82355774e4b6.mutation.json b/corpus/javascript/bin-op-sub/82355774e4b6.mutation.json new file mode 100644 index 00000000..b87a43f2 --- /dev/null +++ b/corpus/javascript/bin-op-sub/82355774e4b6.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 10, + "byte": 10 + }, + "end": { + "line": 0, + "col": 11, + "byte": 11 + } + } + }, + "subst": "0" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/870352073cff.js b/corpus/javascript/bin-op-sub/870352073cff.js new file mode 100644 index 00000000..81517c25 --- /dev/null +++ b/corpus/javascript/bin-op-sub/870352073cff.js @@ -0,0 +1 @@ +const x = -Infinity - 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/870352073cff.mutation.json b/corpus/javascript/bin-op-sub/870352073cff.mutation.json new file mode 100644 index 00000000..0ec1ad06 --- /dev/null +++ b/corpus/javascript/bin-op-sub/870352073cff.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 10, + "byte": 10 + }, + "end": { + "line": 0, + "col": 11, + "byte": 11 + } + } + }, + "subst": "-Infinity" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/8ea44edde927.js b/corpus/javascript/bin-op-sub/8ea44edde927.js new file mode 100644 index 00000000..4fb5cdd8 --- /dev/null +++ b/corpus/javascript/bin-op-sub/8ea44edde927.js @@ -0,0 +1 @@ +const x = Infinity - 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/8ea44edde927.mutation.json b/corpus/javascript/bin-op-sub/8ea44edde927.mutation.json new file mode 100644 index 00000000..8aef4ec1 --- /dev/null +++ b/corpus/javascript/bin-op-sub/8ea44edde927.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 10, + "byte": 10 + }, + "end": { + "line": 0, + "col": 11, + "byte": 11 + } + } + }, + "subst": "Infinity" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/a0087cdb8d8e.js b/corpus/javascript/bin-op-sub/a0087cdb8d8e.js new file mode 100644 index 00000000..d32ccc46 --- /dev/null +++ b/corpus/javascript/bin-op-sub/a0087cdb8d8e.js @@ -0,0 +1 @@ +const x = 1 - Infinity \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/a0087cdb8d8e.mutation.json b/corpus/javascript/bin-op-sub/a0087cdb8d8e.mutation.json new file mode 100644 index 00000000..b1e750ed --- /dev/null +++ b/corpus/javascript/bin-op-sub/a0087cdb8d8e.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 14, + "byte": 14 + }, + "end": { + "line": 0, + "col": 15, + "byte": 15 + } + } + }, + "subst": "Infinity" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/ab67e45e208b.js b/corpus/javascript/bin-op-sub/ab67e45e208b.js new file mode 100644 index 00000000..4a69fd1c --- /dev/null +++ b/corpus/javascript/bin-op-sub/ab67e45e208b.js @@ -0,0 +1 @@ +const x = 1 - 0 \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/ab67e45e208b.mutation.json b/corpus/javascript/bin-op-sub/ab67e45e208b.mutation.json new file mode 100644 index 00000000..5a35fa5b --- /dev/null +++ b/corpus/javascript/bin-op-sub/ab67e45e208b.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 14, + "byte": 14 + }, + "end": { + "line": 0, + "col": 15, + "byte": 15 + } + } + }, + "subst": "0" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/base.js b/corpus/javascript/bin-op-sub/base.js new file mode 100644 index 00000000..cbaddfbe --- /dev/null +++ b/corpus/javascript/bin-op-sub/base.js @@ -0,0 +1 @@ +const x = 1 - 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/be5a0779be2c.js b/corpus/javascript/bin-op-sub/be5a0779be2c.js new file mode 100644 index 00000000..cbaddfbe --- /dev/null +++ b/corpus/javascript/bin-op-sub/be5a0779be2c.js @@ -0,0 +1 @@ +const x = 1 - 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/be5a0779be2c.mutation.json b/corpus/javascript/bin-op-sub/be5a0779be2c.mutation.json new file mode 100644 index 00000000..7368b325 --- /dev/null +++ b/corpus/javascript/bin-op-sub/be5a0779be2c.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 10, + "byte": 10 + }, + "end": { + "line": 0, + "col": 11, + "byte": 11 + } + } + }, + "subst": "1" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/dfb9c27047c5.js b/corpus/javascript/bin-op-sub/dfb9c27047c5.js new file mode 100644 index 00000000..60b2eff0 --- /dev/null +++ b/corpus/javascript/bin-op-sub/dfb9c27047c5.js @@ -0,0 +1 @@ +const x = 1 / 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/dfb9c27047c5.mutation.json b/corpus/javascript/bin-op-sub/dfb9c27047c5.mutation.json new file mode 100644 index 00000000..9dca8f7c --- /dev/null +++ b/corpus/javascript/bin-op-sub/dfb9c27047c5.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "BinaryOp": "Sub" + }, + "subst_span": { + "start": { + "line": 0, + "col": 12, + "byte": 12 + }, + "end": { + "line": 0, + "col": 13, + "byte": 13 + } + } + }, + "subst": "/" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/e079d26ec30c.js b/corpus/javascript/bin-op-sub/e079d26ec30c.js new file mode 100644 index 00000000..f440528b --- /dev/null +++ b/corpus/javascript/bin-op-sub/e079d26ec30c.js @@ -0,0 +1 @@ +const x = -1 - 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/e079d26ec30c.mutation.json b/corpus/javascript/bin-op-sub/e079d26ec30c.mutation.json new file mode 100644 index 00000000..aa8af07d --- /dev/null +++ b/corpus/javascript/bin-op-sub/e079d26ec30c.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 10, + "byte": 10 + }, + "end": { + "line": 0, + "col": 11, + "byte": 11 + } + } + }, + "subst": "-1" +} \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/eb128064f19d.js b/corpus/javascript/bin-op-sub/eb128064f19d.js new file mode 100644 index 00000000..53417da1 --- /dev/null +++ b/corpus/javascript/bin-op-sub/eb128064f19d.js @@ -0,0 +1 @@ +const x = 1 + 2 \ No newline at end of file diff --git a/corpus/javascript/bin-op-sub/eb128064f19d.mutation.json b/corpus/javascript/bin-op-sub/eb128064f19d.mutation.json new file mode 100644 index 00000000..69af80ba --- /dev/null +++ b/corpus/javascript/bin-op-sub/eb128064f19d.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "BinaryOp": "Sub" + }, + "subst_span": { + "start": { + "line": 0, + "col": 12, + "byte": 12 + }, + "end": { + "line": 0, + "col": 13, + "byte": 13 + } + } + }, + "subst": "+" +} \ No newline at end of file diff --git a/corpus/javascript/condition/39e6765d773f.js b/corpus/javascript/condition/39e6765d773f.js new file mode 100644 index 00000000..cd328cc1 --- /dev/null +++ b/corpus/javascript/condition/39e6765d773f.js @@ -0,0 +1 @@ +if (x) {} \ No newline at end of file diff --git a/corpus/javascript/condition/39e6765d773f.mutation.json b/corpus/javascript/condition/39e6765d773f.mutation.json new file mode 100644 index 00000000..8b45b6f8 --- /dev/null +++ b/corpus/javascript/condition/39e6765d773f.mutation.json @@ -0,0 +1,22 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": "StatementBlock", + "subst_span": { + "start": { + "line": 0, + "col": 7, + "byte": 7 + }, + "end": { + "line": 0, + "col": 15, + "byte": 15 + } + } + }, + "subst": "{}" +} \ No newline at end of file diff --git a/corpus/javascript/condition/b492841e1c24.js b/corpus/javascript/condition/b492841e1c24.js new file mode 100644 index 00000000..d667a26e --- /dev/null +++ b/corpus/javascript/condition/b492841e1c24.js @@ -0,0 +1 @@ +if (false) { y(); } \ No newline at end of file diff --git a/corpus/javascript/condition/b492841e1c24.mutation.json b/corpus/javascript/condition/b492841e1c24.mutation.json new file mode 100644 index 00000000..da69810c --- /dev/null +++ b/corpus/javascript/condition/b492841e1c24.mutation.json @@ -0,0 +1,22 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": "Condition", + "subst_span": { + "start": { + "line": 0, + "col": 4, + "byte": 4 + }, + "end": { + "line": 0, + "col": 5, + "byte": 5 + } + } + }, + "subst": "false" +} \ No newline at end of file diff --git a/corpus/javascript/condition/base.js b/corpus/javascript/condition/base.js new file mode 100644 index 00000000..585e3f31 --- /dev/null +++ b/corpus/javascript/condition/base.js @@ -0,0 +1 @@ +if (x) { y(); } \ No newline at end of file diff --git a/corpus/javascript/condition/cae10f0911a4.js b/corpus/javascript/condition/cae10f0911a4.js new file mode 100644 index 00000000..26acc839 --- /dev/null +++ b/corpus/javascript/condition/cae10f0911a4.js @@ -0,0 +1 @@ +if (true) { y(); } \ No newline at end of file diff --git a/corpus/javascript/condition/cae10f0911a4.mutation.json b/corpus/javascript/condition/cae10f0911a4.mutation.json new file mode 100644 index 00000000..d35cb6e4 --- /dev/null +++ b/corpus/javascript/condition/cae10f0911a4.mutation.json @@ -0,0 +1,22 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": "Condition", + "subst_span": { + "start": { + "line": 0, + "col": 4, + "byte": 4 + }, + "end": { + "line": 0, + "col": 5, + "byte": 5 + } + } + }, + "subst": "true" +} \ No newline at end of file diff --git a/corpus/javascript/literal-bool-false/b5bea41b6c62.js b/corpus/javascript/literal-bool-false/b5bea41b6c62.js new file mode 100644 index 00000000..f32a5804 --- /dev/null +++ b/corpus/javascript/literal-bool-false/b5bea41b6c62.js @@ -0,0 +1 @@ +true \ No newline at end of file diff --git a/corpus/javascript/literal-bool-false/b5bea41b6c62.mutation.json b/corpus/javascript/literal-bool-false/b5bea41b6c62.mutation.json new file mode 100644 index 00000000..2e2e2d04 --- /dev/null +++ b/corpus/javascript/literal-bool-false/b5bea41b6c62.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "BoolFalse" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 5, + "byte": 5 + } + } + }, + "subst": "true" +} \ No newline at end of file diff --git a/corpus/javascript/literal-bool-false/base.js b/corpus/javascript/literal-bool-false/base.js new file mode 100644 index 00000000..02e4a84d --- /dev/null +++ b/corpus/javascript/literal-bool-false/base.js @@ -0,0 +1 @@ +false \ No newline at end of file diff --git a/corpus/javascript/literal-bool-true/base.js b/corpus/javascript/literal-bool-true/base.js new file mode 100644 index 00000000..f32a5804 --- /dev/null +++ b/corpus/javascript/literal-bool-true/base.js @@ -0,0 +1 @@ +true \ No newline at end of file diff --git a/corpus/javascript/literal-bool-true/fcbcf165908d.js b/corpus/javascript/literal-bool-true/fcbcf165908d.js new file mode 100644 index 00000000..02e4a84d --- /dev/null +++ b/corpus/javascript/literal-bool-true/fcbcf165908d.js @@ -0,0 +1 @@ +false \ No newline at end of file diff --git a/corpus/javascript/literal-bool-true/fcbcf165908d.mutation.json b/corpus/javascript/literal-bool-true/fcbcf165908d.mutation.json new file mode 100644 index 00000000..2ad1fbc7 --- /dev/null +++ b/corpus/javascript/literal-bool-true/fcbcf165908d.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "BoolTrue" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 4, + "byte": 4 + } + } + }, + "subst": "false" +} \ No newline at end of file diff --git a/corpus/javascript/literal-number/1bad6b8cf971.js b/corpus/javascript/literal-number/1bad6b8cf971.js new file mode 100644 index 00000000..d7d17fcb --- /dev/null +++ b/corpus/javascript/literal-number/1bad6b8cf971.js @@ -0,0 +1 @@ +-1 \ No newline at end of file diff --git a/corpus/javascript/literal-number/1bad6b8cf971.mutation.json b/corpus/javascript/literal-number/1bad6b8cf971.mutation.json new file mode 100644 index 00000000..96c85fd8 --- /dev/null +++ b/corpus/javascript/literal-number/1bad6b8cf971.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + } + }, + "subst": "-1" +} \ No newline at end of file diff --git a/corpus/javascript/literal-number/5feceb66ffc8.js b/corpus/javascript/literal-number/5feceb66ffc8.js new file mode 100644 index 00000000..c2270834 --- /dev/null +++ b/corpus/javascript/literal-number/5feceb66ffc8.js @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/corpus/javascript/literal-number/5feceb66ffc8.mutation.json b/corpus/javascript/literal-number/5feceb66ffc8.mutation.json new file mode 100644 index 00000000..cb1e59ea --- /dev/null +++ b/corpus/javascript/literal-number/5feceb66ffc8.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + } + }, + "subst": "0" +} \ No newline at end of file diff --git a/corpus/javascript/literal-number/6b86b273ff34.js b/corpus/javascript/literal-number/6b86b273ff34.js new file mode 100644 index 00000000..56a6051c --- /dev/null +++ b/corpus/javascript/literal-number/6b86b273ff34.js @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/corpus/javascript/literal-number/6b86b273ff34.mutation.json b/corpus/javascript/literal-number/6b86b273ff34.mutation.json new file mode 100644 index 00000000..6c562915 --- /dev/null +++ b/corpus/javascript/literal-number/6b86b273ff34.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + } + }, + "subst": "1" +} \ No newline at end of file diff --git a/corpus/javascript/literal-number/base.js b/corpus/javascript/literal-number/base.js new file mode 100644 index 00000000..d800886d --- /dev/null +++ b/corpus/javascript/literal-number/base.js @@ -0,0 +1 @@ +123 \ No newline at end of file diff --git a/corpus/javascript/literal-number/c64ddf11bcd4.js b/corpus/javascript/literal-number/c64ddf11bcd4.js new file mode 100644 index 00000000..d8b78745 --- /dev/null +++ b/corpus/javascript/literal-number/c64ddf11bcd4.js @@ -0,0 +1 @@ +-Infinity \ No newline at end of file diff --git a/corpus/javascript/literal-number/c64ddf11bcd4.mutation.json b/corpus/javascript/literal-number/c64ddf11bcd4.mutation.json new file mode 100644 index 00000000..f9d53e2b --- /dev/null +++ b/corpus/javascript/literal-number/c64ddf11bcd4.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + } + }, + "subst": "-Infinity" +} \ No newline at end of file diff --git a/corpus/javascript/literal-number/d0067cad9a63.js b/corpus/javascript/literal-number/d0067cad9a63.js new file mode 100644 index 00000000..5865e1c1 --- /dev/null +++ b/corpus/javascript/literal-number/d0067cad9a63.js @@ -0,0 +1 @@ +Infinity \ No newline at end of file diff --git a/corpus/javascript/literal-number/d0067cad9a63.mutation.json b/corpus/javascript/literal-number/d0067cad9a63.mutation.json new file mode 100644 index 00000000..beb2c2d1 --- /dev/null +++ b/corpus/javascript/literal-number/d0067cad9a63.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + } + }, + "subst": "Infinity" +} \ No newline at end of file diff --git a/corpus/javascript/literal-number/d5b592c05dc2.js b/corpus/javascript/literal-number/d5b592c05dc2.js new file mode 100644 index 00000000..b955cad2 --- /dev/null +++ b/corpus/javascript/literal-number/d5b592c05dc2.js @@ -0,0 +1 @@ +NaN \ No newline at end of file diff --git a/corpus/javascript/literal-number/d5b592c05dc2.mutation.json b/corpus/javascript/literal-number/d5b592c05dc2.mutation.json new file mode 100644 index 00000000..7cfac1ba --- /dev/null +++ b/corpus/javascript/literal-number/d5b592c05dc2.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 3, + "byte": 3 + } + } + }, + "subst": "NaN" +} \ No newline at end of file diff --git a/corpus/javascript/literal-string/12ae32cb1ec0.js b/corpus/javascript/literal-string/12ae32cb1ec0.js new file mode 100644 index 00000000..3cc762b5 --- /dev/null +++ b/corpus/javascript/literal-string/12ae32cb1ec0.js @@ -0,0 +1 @@ +"" \ No newline at end of file diff --git a/corpus/javascript/literal-string/12ae32cb1ec0.mutation.json b/corpus/javascript/literal-string/12ae32cb1ec0.mutation.json new file mode 100644 index 00000000..8fbe9890 --- /dev/null +++ b/corpus/javascript/literal-string/12ae32cb1ec0.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "String" + }, + "subst_span": { + "start": { + "line": 0, + "col": 0, + "byte": 0 + }, + "end": { + "line": 0, + "col": 5, + "byte": 5 + } + } + }, + "subst": "\"\"" +} \ No newline at end of file diff --git a/corpus/javascript/literal-string/base.js b/corpus/javascript/literal-string/base.js new file mode 100644 index 00000000..6de163f8 --- /dev/null +++ b/corpus/javascript/literal-string/base.js @@ -0,0 +1 @@ +'foo' \ No newline at end of file diff --git a/corpus/javascript/optional-chain-literal/515af2f30e43.js b/corpus/javascript/optional-chain-literal/515af2f30e43.js new file mode 100644 index 00000000..fde54762 --- /dev/null +++ b/corpus/javascript/optional-chain-literal/515af2f30e43.js @@ -0,0 +1 @@ +const x = y.z \ No newline at end of file diff --git a/corpus/javascript/optional-chain-literal/515af2f30e43.mutation.json b/corpus/javascript/optional-chain-literal/515af2f30e43.mutation.json new file mode 100644 index 00000000..52d07c3e --- /dev/null +++ b/corpus/javascript/optional-chain-literal/515af2f30e43.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "OptionalChain": "Literal" + }, + "subst_span": { + "start": { + "line": 0, + "col": 11, + "byte": 11 + }, + "end": { + "line": 0, + "col": 13, + "byte": 13 + } + } + }, + "subst": "." +} \ No newline at end of file diff --git a/corpus/javascript/optional-chain-literal/base.js b/corpus/javascript/optional-chain-literal/base.js new file mode 100644 index 00000000..23301923 --- /dev/null +++ b/corpus/javascript/optional-chain-literal/base.js @@ -0,0 +1 @@ +const x = y?.z \ No newline at end of file diff --git a/corpus/javascript/statement-block/16264e3d19e3.js b/corpus/javascript/statement-block/16264e3d19e3.js new file mode 100644 index 00000000..b417e60d --- /dev/null +++ b/corpus/javascript/statement-block/16264e3d19e3.js @@ -0,0 +1 @@ +function f() { return NaN; } \ No newline at end of file diff --git a/corpus/javascript/statement-block/16264e3d19e3.mutation.json b/corpus/javascript/statement-block/16264e3d19e3.mutation.json new file mode 100644 index 00000000..54140911 --- /dev/null +++ b/corpus/javascript/statement-block/16264e3d19e3.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 22, + "byte": 22 + }, + "end": { + "line": 0, + "col": 23, + "byte": 23 + } + } + }, + "subst": "NaN" +} \ No newline at end of file diff --git a/corpus/javascript/statement-block/224a68b61da1.js b/corpus/javascript/statement-block/224a68b61da1.js new file mode 100644 index 00000000..9aa2d181 --- /dev/null +++ b/corpus/javascript/statement-block/224a68b61da1.js @@ -0,0 +1 @@ +function f() {} \ No newline at end of file diff --git a/corpus/javascript/statement-block/224a68b61da1.mutation.json b/corpus/javascript/statement-block/224a68b61da1.mutation.json new file mode 100644 index 00000000..e8b54f9b --- /dev/null +++ b/corpus/javascript/statement-block/224a68b61da1.mutation.json @@ -0,0 +1,22 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": "StatementBlock", + "subst_span": { + "start": { + "line": 0, + "col": 13, + "byte": 13 + }, + "end": { + "line": 0, + "col": 26, + "byte": 26 + } + } + }, + "subst": "{}" +} \ No newline at end of file diff --git a/corpus/javascript/statement-block/4deb5566ad40.js b/corpus/javascript/statement-block/4deb5566ad40.js new file mode 100644 index 00000000..47390a03 --- /dev/null +++ b/corpus/javascript/statement-block/4deb5566ad40.js @@ -0,0 +1 @@ +function f() { return 1; } \ No newline at end of file diff --git a/corpus/javascript/statement-block/4deb5566ad40.mutation.json b/corpus/javascript/statement-block/4deb5566ad40.mutation.json new file mode 100644 index 00000000..20f7e614 --- /dev/null +++ b/corpus/javascript/statement-block/4deb5566ad40.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 22, + "byte": 22 + }, + "end": { + "line": 0, + "col": 23, + "byte": 23 + } + } + }, + "subst": "1" +} \ No newline at end of file diff --git a/corpus/javascript/statement-block/6272c6bcce57.js b/corpus/javascript/statement-block/6272c6bcce57.js new file mode 100644 index 00000000..a2fca97b --- /dev/null +++ b/corpus/javascript/statement-block/6272c6bcce57.js @@ -0,0 +1 @@ +function f() { return Infinity; } \ No newline at end of file diff --git a/corpus/javascript/statement-block/6272c6bcce57.mutation.json b/corpus/javascript/statement-block/6272c6bcce57.mutation.json new file mode 100644 index 00000000..b51848d7 --- /dev/null +++ b/corpus/javascript/statement-block/6272c6bcce57.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 22, + "byte": 22 + }, + "end": { + "line": 0, + "col": 23, + "byte": 23 + } + } + }, + "subst": "Infinity" +} \ No newline at end of file diff --git a/corpus/javascript/statement-block/7f1c58cf9aa5.js b/corpus/javascript/statement-block/7f1c58cf9aa5.js new file mode 100644 index 00000000..2bd549c0 --- /dev/null +++ b/corpus/javascript/statement-block/7f1c58cf9aa5.js @@ -0,0 +1 @@ +function f() { return -1; } \ No newline at end of file diff --git a/corpus/javascript/statement-block/7f1c58cf9aa5.mutation.json b/corpus/javascript/statement-block/7f1c58cf9aa5.mutation.json new file mode 100644 index 00000000..94ffebcd --- /dev/null +++ b/corpus/javascript/statement-block/7f1c58cf9aa5.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 22, + "byte": 22 + }, + "end": { + "line": 0, + "col": 23, + "byte": 23 + } + } + }, + "subst": "-1" +} \ No newline at end of file diff --git a/corpus/javascript/statement-block/base.js b/corpus/javascript/statement-block/base.js new file mode 100644 index 00000000..47390a03 --- /dev/null +++ b/corpus/javascript/statement-block/base.js @@ -0,0 +1 @@ +function f() { return 1; } \ No newline at end of file diff --git a/corpus/javascript/statement-block/c0e138b2c3ff.js b/corpus/javascript/statement-block/c0e138b2c3ff.js new file mode 100644 index 00000000..8c92e418 --- /dev/null +++ b/corpus/javascript/statement-block/c0e138b2c3ff.js @@ -0,0 +1 @@ +function f() { return 0; } \ No newline at end of file diff --git a/corpus/javascript/statement-block/c0e138b2c3ff.mutation.json b/corpus/javascript/statement-block/c0e138b2c3ff.mutation.json new file mode 100644 index 00000000..7c334b6d --- /dev/null +++ b/corpus/javascript/statement-block/c0e138b2c3ff.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 22, + "byte": 22 + }, + "end": { + "line": 0, + "col": 23, + "byte": 23 + } + } + }, + "subst": "0" +} \ No newline at end of file diff --git a/corpus/javascript/statement-block/dc8cc806e4ba.js b/corpus/javascript/statement-block/dc8cc806e4ba.js new file mode 100644 index 00000000..8062cefc --- /dev/null +++ b/corpus/javascript/statement-block/dc8cc806e4ba.js @@ -0,0 +1 @@ +function f() { return -Infinity; } \ No newline at end of file diff --git a/corpus/javascript/statement-block/dc8cc806e4ba.mutation.json b/corpus/javascript/statement-block/dc8cc806e4ba.mutation.json new file mode 100644 index 00000000..4584bed6 --- /dev/null +++ b/corpus/javascript/statement-block/dc8cc806e4ba.mutation.json @@ -0,0 +1,24 @@ +{ + "mutant": { + "lang": "js", + "twig": [ + "src/a.js" + ], + "kind": { + "Literal": "Number" + }, + "subst_span": { + "start": { + "line": 0, + "col": 22, + "byte": 22 + }, + "end": { + "line": 0, + "col": 23, + "byte": 23 + } + } + }, + "subst": "-Infinity" +} \ No newline at end of file diff --git a/crates/bough-core/src/lib.rs b/crates/bough-core/src/lib.rs index 658f7cc9..123b86d0 100644 --- a/crates/bough-core/src/lib.rs +++ b/crates/bough-core/src/lib.rs @@ -4,7 +4,7 @@ mod base; mod facet_disk_store; mod file; mod language; -mod mutant; +pub mod mutant; mod mutation; mod mutation_score; mod phase; @@ -35,13 +35,17 @@ pub enum LanguageId { Typescript, } +pub use base::Base; pub use file::File; +pub use file::Twig; pub use mutation::Mutation; pub use mutation::MutationHash; +pub use mutation::MutationIter; pub use mutation_score::Factor; pub use phase::Error as PhaseError; pub use phase::PhaseOutcome; pub use session::Config; pub use session::Session; pub use state::{State, Status}; +pub use twig::TwigsIterBuilder; pub use workspace::{Workspace, WorkspaceId}; diff --git a/crates/bough-corpus-tests/Cargo.toml b/crates/bough-corpus-tests/Cargo.toml new file mode 100644 index 00000000..d5241233 --- /dev/null +++ b/crates/bough-corpus-tests/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "bough-corpus-tests" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +readme.workspace = true +description = "Corpus-based mutation snapshot tests for bough" + +[dependencies] +bough-core = { workspace = true } +sha2 = "0.10" +hex = "0.4" +facet-json = "0.44.1" + +tempfile = "3.26" diff --git a/crates/bough-corpus-tests/build.rs b/crates/bough-corpus-tests/build.rs new file mode 100644 index 00000000..bc2048ae --- /dev/null +++ b/crates/bough-corpus-tests/build.rs @@ -0,0 +1,76 @@ +use std::fs; +use std::io::Write; +use std::path::Path; + +fn main() { + let corpus_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../corpus"); + let out_dir = std::env::var("OUT_DIR").unwrap(); + let gen_path = Path::new(&out_dir).join("corpus_tests.rs"); + + println!("cargo:rerun-if-changed=../../corpus"); + + let mut out = fs::File::create(&gen_path).unwrap(); + + if !corpus_dir.exists() { + return; + } + + let mut lang_dirs: Vec<_> = fs::read_dir(&corpus_dir) + .unwrap() + .filter_map(|e| e.ok()) + .filter(|e| e.file_type().map(|t| t.is_dir()).unwrap_or(false)) + .collect(); + lang_dirs.sort_by_key(|e| e.file_name()); + + for lang_entry in lang_dirs { + let lang_name = lang_entry.file_name(); + let lang_str = lang_name.to_str().unwrap(); + + let lang_id = match lang_str { + "javascript" => "bough_core::LanguageId::Javascript", + "typescript" => "bough_core::LanguageId::Typescript", + _ => continue, + }; + + let ext = match lang_str { + "javascript" => "js", + "typescript" => "ts", + _ => continue, + }; + + let mut case_dirs: Vec<_> = fs::read_dir(lang_entry.path()) + .unwrap() + .filter_map(|e| e.ok()) + .filter(|e| e.file_type().map(|t| t.is_dir()).unwrap_or(false)) + .collect(); + case_dirs.sort_by_key(|e| e.file_name()); + + for case_entry in case_dirs { + let case_name = case_entry.file_name(); + let case_str = case_name.to_str().unwrap(); + let base_file = case_entry.path().join(format!("base.{ext}")); + if !base_file.exists() { + continue; + } + + let fn_name = format!("{lang_str}__{}", case_str.replace('-', "_")); + let case_path = case_entry + .path() + .canonicalize() + .unwrap() + .to_str() + .unwrap() + .to_string(); + + writeln!(out, "#[test]").unwrap(); + writeln!(out, "fn {fn_name}() {{").unwrap(); + writeln!( + out, + " crate::corpus_test_runner(\"{case_path}\", {lang_id}, \"{ext}\");", + ) + .unwrap(); + writeln!(out, "}}").unwrap(); + writeln!(out).unwrap(); + } + } +} diff --git a/crates/bough-corpus-tests/src/lib.rs b/crates/bough-corpus-tests/src/lib.rs new file mode 100644 index 00000000..3f7fbb24 --- /dev/null +++ b/crates/bough-corpus-tests/src/lib.rs @@ -0,0 +1,124 @@ +use bough_core::mutant::TwigMutantsIter; +use bough_core::{Base, LanguageId, Mutation, MutationIter, Twig, TwigsIterBuilder}; +use sha2::{Digest, Sha256}; +use std::collections::HashSet; +use std::path::{Path, PathBuf}; + +fn content_hash(content: &str) -> String { + let mut hasher = Sha256::new(); + hasher.update(content.as_bytes()); + let result = hasher.finalize(); + hex::encode(&result[..6]) +} + +fn corpus_test_runner(case_dir: &str, lang: LanguageId, ext: &str) { + let case_path = Path::new(case_dir); + let base_file = case_path.join(format!("base.{ext}")); + let src = std::fs::read_to_string(&base_file) + .unwrap_or_else(|e| panic!("failed to read {}: {e}", base_file.display())); + + let dir = tempfile::tempdir().unwrap(); + std::fs::create_dir_all(dir.path().join("src")).unwrap(); + std::fs::write(dir.path().join(format!("src/a.{ext}")), &src).unwrap(); + + let base = Base::new( + dir.path().to_path_buf(), + TwigsIterBuilder::new().with_include_glob(&format!("src/**/*.{ext}")), + ) + .unwrap(); + + let twig = Twig::new(PathBuf::from(format!("src/a.{ext}"))).unwrap(); + + let mutations: Vec<(String, Mutation)> = TwigMutantsIter::new(lang, &base, &twig) + .unwrap() + .flat_map(|bm| { + let mutant = bm.into_mutant(); + MutationIter::new(&mutant) + .map(|mutation| { + let mutated_src = mutation.apply_to_complete_src_string(&src); + (mutated_src, mutation) + }) + .collect::>() + }) + .collect(); + + let mut produced_files: HashSet = HashSet::new(); + let update_mode = std::env::var("BOUGH_UPDATE_CORPUS").is_ok(); + + for (mutated_src, mutation) in &mutations { + let hash = content_hash(mutated_src); + let src_file = format!("{hash}.{ext}"); + let json_file = format!("{hash}.mutation.json"); + produced_files.insert(src_file.clone()); + produced_files.insert(json_file.clone()); + + let src_path = case_path.join(&src_file); + let json_path = case_path.join(&json_file); + + if !src_path.exists() { + std::fs::write(&src_path, mutated_src) + .unwrap_or_else(|e| panic!("failed to write {}: {e}", src_path.display())); + eprintln!("wrote new mutation: {}", src_path.display()); + } else { + let existing = std::fs::read_to_string(&src_path).unwrap(); + assert_eq!( + existing, *mutated_src, + "mutation content mismatch in {}", + src_path.display() + ); + } + + let json = facet_json::to_string_pretty(mutation) + .unwrap_or_else(|e| panic!("failed to serialize mutation to json: {e}")); + if !json_path.exists() { + std::fs::write(&json_path, &json) + .unwrap_or_else(|e| panic!("failed to write {}: {e}", json_path.display())); + eprintln!("wrote new mutation json: {}", json_path.display()); + } else { + let existing = std::fs::read_to_string(&json_path).unwrap(); + assert_eq!( + existing, json, + "mutation json mismatch in {}", + json_path.display() + ); + } + + + } + + produced_files.insert(format!("base.{ext}")); + + let existing_files: HashSet = std::fs::read_dir(case_path) + .unwrap() + .filter_map(|e| e.ok()) + .filter(|e| e.file_type().map(|t| t.is_file()).unwrap_or(false)) + .map(|e| e.file_name().to_str().unwrap().to_string()) + .collect(); + + let stale: Vec<_> = existing_files.difference(&produced_files).collect(); + + if !stale.is_empty() { + if update_mode { + for file in &stale { + let path = case_path.join(file); + std::fs::remove_file(&path) + .unwrap_or_else(|e| panic!("failed to remove stale {}: {e}", path.display())); + eprintln!("removed stale file: {}", path.display()); + } + } else { + let mut stale_sorted: Vec<_> = stale.into_iter().collect(); + stale_sorted.sort(); + panic!( + "stale files in {}: {:?}\nSet BOUGH_UPDATE_CORPUS=1 to auto-remove", + case_path.display(), + stale_sorted + ); + } + } +} + +#[cfg(test)] +#[allow(non_snake_case)] +mod tests { + include!(concat!(env!("OUT_DIR"), "/corpus_tests.rs")); +}