diff --git a/Cakefile b/Cakefile index 8a5ab2787d..49379391e4 100644 --- a/Cakefile +++ b/Cakefile @@ -7,6 +7,7 @@ _ = require 'underscore' CoffeeScript = require './lib/coffeescript' helpers = require './lib/coffeescript/helpers' { setupConsole } = require './build-support/console' +{ PatternSet } = require './build-support/patterns' # ANSI Terminal Colors. bold = red = green = yellow = reset = '' @@ -428,27 +429,6 @@ task 'bench', 'quick benchmark of compilation time', -> console.log "total #{ fmt total }" -class PatternSet - constructor: (patternStrings = [], {@negated = no} = {}) -> - @matchers = (new RegExp p for p in patternStrings when p isnt '') - - isEmpty: -> @matchers.length is 0 - - iterMatchers: -> @matchers[Symbol.iterator]() - - test_: (arg) -> @iterMatchers().some (m) -> m.exec arg - - allows: (arg) -> - return yes if @isEmpty() - if @negated - not @test_ arg - else - @test_ arg - - @fromCommaDelimitedList: (commaListStr) => new @ (commaListStr ? '').split /,/ - @empty: ({negated = no} = {}) => new @ [], {negated} - - # Run the CoffeeScript test suite. runTests = (CoffeeScript, {filePatterns, negFilePatterns, descPatterns, negDescPatterns} = {}) -> CoffeeScript.register() unless global.testingBrowser @@ -457,7 +437,7 @@ runTests = (CoffeeScript, {filePatterns, negFilePatterns, descPatterns, negDescP negFilePatterns ?= PatternSet.empty {negated: yes} descPatterns ?= PatternSet.empty() negDescPatterns ?= PatternSet.empty {negated: yes} - console.dir {filePatterns, negFilePatterns, descPatterns, negDescPatterns} + console.dir.debug {filePatterns, negFilePatterns, descPatterns, negDescPatterns} # These are attached to `global` so that they’re accessible from within # `test/async.coffee`, which has an async-capable version of @@ -577,9 +557,9 @@ option null, '--negDesc [REGEXP*]', 'test description patterns to negatively mat task 'test', 'run the CoffeeScript language test suite', ({ file = [], - negFile = ['sourcemap'], + negFile = [], desc = [], - negDesc = ['#4418', '#4558', 'dynamic import assertion', 'assert keyword'], + negDesc = [], } = {}) -> testOptions = filePatterns: new PatternSet file diff --git a/build-support/patterns.coffee b/build-support/patterns.coffee new file mode 100644 index 0000000000..e164324a3e --- /dev/null +++ b/build-support/patterns.coffee @@ -0,0 +1,18 @@ +exports.PatternSet = class PatternSet + constructor: (patternStrings = [], {@negated = no} = {}) -> + @matchers = (new RegExp p for p in patternStrings when p isnt '') + + isEmpty: -> @matchers.length is 0 + + iterMatchers: -> @matchers[Symbol.iterator]() + + test_: (arg) -> @iterMatchers().some (m) -> m.exec arg + + allows: (arg) -> + return yes if @isEmpty() + if @negated + not @test_ arg + else + @test_ arg + + @empty: ({negated = no} = {}) => new @ [], {negated}