Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add acceptance task

  • Loading branch information...
commit 5ee990c14aa07990e378f78f1a49078a21233b0f 1 parent ca59135
Josep M. Bach authored
10 Rakefile
View
@@ -8,7 +8,15 @@ RSpec::Core::RakeTask.new
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << "test"
- t.test_files = FileList['test/**/*_test.rb']
+ t.test_files = FileList['test/**/*_test.rb'] - FileList['test/acceptance/**/*_test.rb']
+ t.verbose = true
+end
+
+require 'rake/testtask'
+desc 'Run acceptance tests (Scheme programs inside examples/ directory)'
+Rake::TestTask.new :acceptance do |t|
+ t.libs << "test"
+ t.test_files = FileList['test/acceptance/**/*_test.rb']
t.verbose = true
end
18 test/acceptance/lexer_acceptance_test.rb
View
@@ -0,0 +1,18 @@
+require 'test_helper'
+
+module Schemer
+ class LexerAcceptanceTest < MiniTest::Unit::TestCase
+ def test_lexer_acceptance
+ lexer = Lexer.new
+
+ Dir["examples/*.scm"].each do |filename|
+ file = File.read(filename)
+ begin
+ refute_nil lexer.parse(file)
+ rescue Parslet::ParseFailed
+ flunk "Lexer could not tokenize #{filename}."
+ end
+ end
+ end
+ end
+end
13 test/schemer/lexer_test.rb
View
@@ -2,7 +2,6 @@
module Schemer
class LexerTest < MiniTest::Unit::TestCase
-
def setup
@lexer = Lexer.new
end
@@ -78,17 +77,6 @@ def test_list
tokenizes("(lambda (define (make-new-set?) '()) (define (make-new-set?) '(2 3)))")
end
- def test_regression_from_examples_directory
- Dir["examples/*.scm"].each do |filename|
- file = File.read(filename)
- begin
- @lexer.parse(file)
- rescue Parslet::ParseFailed
- flunk "Lexer could not tokenize #{filename}."
- end
- end
- end
-
private
def tokenizes(input, options = {})
@@ -112,6 +100,5 @@ def does_not_tokenize(input)
@lexer.send(rule).parse(input)
end
end
-
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.