var assert = require("assert"); var UglifyJS = require("../node"); describe("Getters and setters", function() { it("Should not accept operator symbols as getter/setter name", function() { var illegalOperators = [ "++", "--", "+", "-", "!", "~", "&", "|", "^", "*", "/", "%", ">>", "<<", ">>>", "<", ">", "<=", ">=", "==", "===", "!=", "!==", "?", "=", "+=", "-=", "/=", "*=", "%=", ">>=", "<<=", ">>>=", "|=", "^=", "&=", "&&", "||" ]; var generator = function() { var results = []; for (var i in illegalOperators) { results.push({ code: "var obj = { get " + illegalOperators[i] + "() { return test; }};", operator: illegalOperators[i], method: "get" }); results.push({ code: "var obj = { set " + illegalOperators[i] + "(value) { test = value}};", operator: illegalOperators[i], method: "set" }); } return results; }; var testCase = function(data) { return function() { UglifyJS.parse(data.code); }; }; var fail = function(data) { return function(e) { return e instanceof UglifyJS.JS_Parse_Error && e.message === "Unexpected token: operator «" + data.operator + "»"; }; }; var errorMessage = function(data) { return "Expected but didn't get a syntax error while parsing following line:\n" + data.code; }; var tests = generator(); for (var i = 0; i < tests.length; i++) { var test = tests[i]; assert.throws(testCase(test), fail(test), errorMessage(test)); } }); }); t nowrap'>AgeCommit message (Expand)Author 2017-04-22cache: Work around 'time-monotonic' bug in Guile 2.2.2....* guix/cache.scm (time-monotonic) [guile-2.2]: New variable. * tests/cache.scm (time-monotonic) [guile-2.2]: Likewise. * guix/build/download.scm (time-monotonic) [guile-2.2]: Adjust comment: it's a 2.2.2 bug. Ludovic Courtès 2017-04-18Add (guix cache) and use it in (guix scripts substitute)....* guix/cache.scm, tests/cache.scm: New files. * Makefile.am (MODULES, SCM_TESTS): Add them. * guix/scripts/substitute.scm (obsolete?): Remove. (remove-expired-cached-narinfos): Rename to... (cached-narinfo-expiration-time): ... this. Remove the removal part and only keep the expiration time part. (narinfo-cache-directories): Add optional 'directory' parameter and honor it. (maybe-remove-expired-cached-narinfo): Remove. (cached-narinfo-files): New procedure. (guix-substitute): Use 'maybe-remove-expired-cache-entries' instead of 'maybe-remove-expired-cached-narinfo'. Ludovic Courtès