eval_collapse_vars: { options = { booleans: true, collapse_vars: true, comparisons: true, conditionals: true, dead_code: true, evaluate: true, hoist_funs: true, if_return: true, join_vars: true, keep_fargs: true, loops: true, properties: true, sequences: false, side_effects: true, unused: true, } input: { function f1() { var e = 7; var s = "abcdef"; var i = 2; var eval = console.log.bind(console); var x = s.charAt(i++); var y = s.charAt(i++); var z = s.charAt(i++); eval(x, y, z, e); } function p1() { var a = foo(), b = bar(), eval = baz(); return a + b + eval; } function p2() { var a = foo(), b = bar(), eval = baz; return a + b + eval(); } (function f2(eval) { var a = 2; console.log(a - 5); eval("console.log(a);"); })(eval); } expect: { function f1() { var e = 7, s = "abcdef", i = 2, eval = console.log.bind(console), x = s.charAt(i++), y = s.charAt(i++), z = s.charAt(i++); eval(x, y, z, e); } function p1() { return foo() + bar() + baz(); } function p2() { var a = foo(), b = bar(), eval = baz; return a + b + eval(); } (function f2(eval) { var a = 2; console.log(a - 5); eval("console.log(a);"); })(eval); } expect_stdout: true } eval_unused: { options = { keep_fargs: false, unused: true, } input: { function o(k) { return { c: 14 }[k]; } console.log(function f1(a, eval, c, d, e) { return a("c") + eval; }(o, 28, true)); console.log(function f2(a, b, c, d, e) { return a + eval("c"); }(14, true, 28)); console.log(function f3(a, eval, c, d, e) { return a + eval("c"); }(28, o, true)); } expect: { function o(k) { return { c: 14 }[k]; } console.log(function(a, eval) { return a("c") + eval; }(o, 28)); console.log(function f2(a, b, c, d, e) { return a + eval("c"); }(14, true, 28)); console.log(function f3(a, eval, c, d, e) { return a + eval("c"); }(28, o, true)); } expect_stdout: [ "42", "42", "42", ] } eval_mangle: { mangle = {} beautify = { beautify: true, } input: { function o(k) { return { cc: 14 }[k + "c"]; } console.log(function f1(a, eval, c, d, e) { return a("c") + eval; }(o, 28, true)); console.log(function f2(a, b, c, d, e) { return a + eval("c"); }(14, true, 28)); console.log(function f3(a, eval, c, d, e) { return a + eval("c"); }(28, o, true)); } expect_exact: [ "function o(o) {", " return {", " cc: 14", ' }[o + "c"];', "}", "", "console.log(function o(c, e, n, r, t) {", ' return c("c") + e;', "}(o, 28, true));", "", "console.log(function f2(a, b, c, d, e) {", ' return a + eval("c");', "}(14, true, 28));", "", "console.log(function f3(a, eval, c, d, e) {", ' return a + eval("c");', "}(28, o, true));", ] expect_stdout: [ "42", "42", "42", ] } d an exec-based shebang and set the script executable bit. (main): Insert a newline after the version string is printed with --version. Maxim Cournoyer 2021-01-31build: test-driver.scm: Add a new '--errors-only' option....* build-aux/test-driver.scm (show-help): Add the help text for the new '--errors-only' option. (%options): Add the errors-only option. (test-runner-gnu): Add the errors-only? parameter and update doc. Move the logging of the test data after the test has completed, so a choice can be made whether to keep it or discard it based on the value of the test result. (main): Pass the errors-only? option to the driver. * doc/guix.texi (Running the Test Suite): Document the new option. Maxim Cournoyer 2021-01-31build: test-driver.scm: Add test cases filtering options....* build-aux/test-driver.scm (show-help): Add help text for the new --select and --exclude options. (%options): Add the new select and exclude options. (test-runner-gnu): Pass them to the test runner. Update doc. (test-match-name*, test-match-name*/negated, %test-match-all): New variables. (main): Compute the test specifier based on the values of the new options and apply it to the current test runner when running the test file. * doc/guix.texi (Running the Test Suite): Document the new options. Maxim Cournoyer 2021-01-31build: test-driver.scm: Enable colored test results by default....The Automake parallel test harness does its own smart detection of the terminal color capability and always provides the --color-tests argument to the driver. This change defaults the --color-tests argument to true when the test driver is run on its own (not via Automake). * build-aux/test-driver.scm (main): Set the default value of the --color-tests argument to true when it's not explicitly provided. Maxim Cournoyer 2021-01-31build: test-driver.scm: Make output redirection optional....This makes it easier (and less surprising) for users to experiment with the custom Scheme test driver directly. The behavior is unchanged from Automake's point of view. * build-aux/test-driver.scm (main): Make the --log-file and --trs-file arguments optional and update doc. Only open, redirect and close a port to a log file when the --log-file option is provided. Only open and close a port to a trs file when the --trs-file option is provided. (test-runner-gnu): Set OUT-PORT parameter default value to the current output port. Set the TRS-PORT parameter default value to a void port. Update doc. Maxim Cournoyer