Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

need compiler specs

  • Loading branch information...
commit 5e82c45d405cc7d5aa71c14fae5700be8991c8ba 1 parent 9722a95
Konstantin Haase authored
Showing with 20 additions and 0 deletions.
  1. +7 −0 spec/compiler_spec.rb
  2. +13 −0 spec/spec_helper.rb
7 spec/compiler_spec.rb
View
@@ -0,0 +1,7 @@
+require File.expand_path('../spec_helper', __FILE__)
+
+describe Reak::Compiler do
+ subject { Reak::Compiler.new }
+ context :sexp do
+ end
+end
13 spec/spec_helper.rb
View
@@ -1,5 +1,6 @@
require 'rspec'
require 'reak'
+require 'pp'
RSpec.configure do |config|
config.expect_with :rspec
@@ -7,11 +8,23 @@
$oot = $stderr
+RSpec::Matchers.define(:compile) do |input|
+ match do |compiler|
+ @compiler = compiler
+ @result = compiler.compile(input)
+ end
+
+ chain(:to) do |sexp|
+ @result.to_sexp.should == sexp
+ end
+end
+
RSpec::Matchers.define(:parse) do |input|
match do |parser|
@parser = parser
begin
@result = parser.parse(input)
+ #pp Reak::Parser::Transformer.new.apply(@result)
@as == @result or @as.nil?
rescue Parslet::ParseFailed => e
@error = e
Please sign in to comment.
Something went wrong with that request. Please try again.