Sha256: f52970f86ceb480dc7fb2da97cf8fb1f7aaec60645bdee455f95b6edbc05e4bb
Contents?: true
Size: 774 Bytes
Versions: 5
Compression:
Stored size: 774 Bytes
Contents
require "rake" module Jstdutil # Knows how to map source files to test files, how to extract test cases # and so on. # class TestFile def initialize(file) @file = file end def test_files return @test_files if @test_files if @file =~ /([-_]test[^\/]+)|([^\/]+[-_]test)\.js/ @test_files = [@file] else name = File.basename(@file).gsub(/([-_]test)|(test[-_])|(\.js)/, "") @test_files = FileList["**/#{name}_test.js", "**/test_#{name}.js", "**/#{name}-test.js", "**/test-#{name}.js"].uniq end end def test_cases return @cases if @cases @cases = test_files.collect do |file| File.read(file).scan(/estCase\(["']([^"']*)/) end @cases.flatten! end end end
Version data entries
5 entries across 5 versions & 1 rubygems