jslint on json data
This commit is contained in:
parent
c7d7be6ed2
commit
a69ae2e4ab
@ -35,11 +35,11 @@ module Hydra #:nodoc:
|
|||||||
trace "Running file: #{file}"
|
trace "Running file: #{file}"
|
||||||
|
|
||||||
output = ""
|
output = ""
|
||||||
if file =~ /_spec.rb$/
|
if file =~ /_spec.rb$/i
|
||||||
output = run_rspec_file(file)
|
output = run_rspec_file(file)
|
||||||
elsif file =~ /.feature$/
|
elsif file =~ /.feature$/i
|
||||||
output = run_cucumber_file(file)
|
output = run_cucumber_file(file)
|
||||||
elsif file =~ /.js$/
|
elsif file =~ /.js$/i or file =~ /.json$/i
|
||||||
output = run_javascript_file(file)
|
output = run_javascript_file(file)
|
||||||
else
|
else
|
||||||
output = run_test_unit_file(file)
|
output = run_test_unit_file(file)
|
||||||
|
4
test/fixtures/json_data.json
vendored
Normal file
4
test/fixtures/json_data.json
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"var1": "something",
|
||||||
|
"var2": "trailing comma",
|
||||||
|
}
|
@ -43,6 +43,12 @@ class RunnerTest < Test::Unit::TestCase
|
|||||||
assert results =~ /Missing semicolon/
|
assert results =~ /Missing semicolon/
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "run a json data file and find errors" do
|
||||||
|
runner = Hydra::Runner.new(:io => File.new('/dev/null', 'w'))
|
||||||
|
results = runner.run_file(json_file)
|
||||||
|
assert results =~ /trailing comma/
|
||||||
|
end
|
||||||
|
|
||||||
should "run two rspec tests" do
|
should "run two rspec tests" do
|
||||||
runner = Hydra::Runner.new(:io => File.new('/dev/null', 'w'))
|
runner = Hydra::Runner.new(:io => File.new('/dev/null', 'w'))
|
||||||
runner.run_file(rspec_file)
|
runner.run_file(rspec_file)
|
||||||
|
@ -46,6 +46,10 @@ class Test::Unit::TestCase
|
|||||||
def javascript_file
|
def javascript_file
|
||||||
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'js_file.js'))
|
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'js_file.js'))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def json_file
|
||||||
|
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'json_data.json'))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module Hydra #:nodoc:
|
module Hydra #:nodoc:
|
||||||
|
Loading…
Reference in New Issue
Block a user