From 4241d44de87d8f04f593f683e913980bc746b3d6 Mon Sep 17 00:00:00 2001 From: Samantha McVey Date: Wed, 9 Nov 2016 18:06:38 -0800 Subject: Add support for checking YAML validity using Travis CI --- Rakefile | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Rakefile (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile new file mode 100644 index 00000000..49c90d5e --- /dev/null +++ b/Rakefile @@ -0,0 +1,5 @@ +task default: %w[test] + +task :test do + ruby "tests/yaml.rb" +end -- cgit v1.2.3 From 58ffb4057fcd67e5c0ba33f76344cc8ad927c72b Mon Sep 17 00:00:00 2001 From: Samantha McVey Date: Wed, 9 Nov 2016 20:24:10 -0800 Subject: Add UTF-8 check test --- Rakefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 49c90d5e..b41beab5 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,7 @@ task default: %w[test] task :test do - ruby "tests/yaml.rb" + Dir["./tests/*.rb"].each do |test_file| + ruby test_file + end end -- cgit v1.2.3 From 70d6977ccc07b667da0ed165b7706afbb5190816 Mon Sep 17 00:00:00 2001 From: Samantha McVey Date: Wed, 9 Nov 2016 20:57:13 -0800 Subject: Use charlock_holmes to do encoding detection. In my tests it has properly identified incorrect encodings that used to be present on older commits. This will help ensure this won't happen again, giving people instant feedback and allowing all pull requests to be checked --- Rakefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index b41beab5..0193d816 100644 --- a/Rakefile +++ b/Rakefile @@ -2,6 +2,10 @@ task default: %w[test] task :test do Dir["./tests/*.rb"].each do |test_file| - ruby test_file + begin + ruby test_file + rescue + puts "FAILED #{test_file}!" + end end end -- cgit v1.2.3 From 03980b63c7f7fa5bfd6a74e23613bcf82392105a Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 9 Nov 2016 22:10:35 -0800 Subject: Fix encoding test, then make tests actually fail. --- Rakefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 0193d816..b87f1aef 100644 --- a/Rakefile +++ b/Rakefile @@ -1,11 +1,19 @@ task default: %w[test] task :test do + failed = false Dir["./tests/*.rb"].each do |test_file| begin - ruby test_file + ruby test_file + puts "" rescue puts "FAILED #{test_file}!" + puts "" + failed = true end end + + if failed + exit 0 + end end -- cgit v1.2.3 From bb5e514321732ee6fac150cdbfb587cca5c20433 Mon Sep 17 00:00:00 2001 From: Samantha McVey Date: Wed, 9 Nov 2016 22:15:03 -0800 Subject: Update rakefile so that it will return an exit code of 1 if there is a failure (Travis CI needs this). Make ISO-8859* encoding detections notices not failures --- Rakefile | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index b87f1aef..6a31bd72 100644 --- a/Rakefile +++ b/Rakefile @@ -1,19 +1,23 @@ -task default: %w[test] - -task :test do - failed = false - Dir["./tests/*.rb"].each do |test_file| - begin - ruby test_file - puts "" - rescue - puts "FAILED #{test_file}!" - puts "" - failed = true - end +task default: %w[encoding yaml return_code] +$failure = 0 +task :encoding do + begin + ruby 'tests/encoding.rb' + rescue Exception => msg + puts msg + $failure += 1 end - - if failed - exit 0 +end +task :yaml do + begin + ruby 'tests/yaml.rb' + rescue Exception => msg + puts msg + $failure += 1 + end +end +task :return_code do + if $failure != 0 + raise "Failed #{$failure} tests!!" end end -- cgit v1.2.3