Skip to content

Commit

Permalink
Test case for Fixnum rewrites
Browse files Browse the repository at this point in the history
  • Loading branch information
vidarh committed May 27, 2013
1 parent 2cccb7f commit c0acf92
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions features/step_definitions/transform_steps.rb
@@ -0,0 +1,10 @@
$: << File.expand_path(File.dirname(__FILE__)+"/../..")

require 'transform'

# The rest is shared with the parser steps

When(/^I preprocess it with the compiler transformations$/) do
Compiler.new.preprocess(@tree)
end

16 changes: 16 additions & 0 deletions features/transform.feature
@@ -0,0 +1,16 @@

Feature: Transformations
In order to implement the correct semantics, the compiler post-processes
the output from the Parser to modify the AST.

Scenario Outline: Simple expressions
Given the expression <expr>
When I parse it with the full parser
And I preprocess it with the compiler transformations
Then the parse tree should become <tree>

Examples:
| expr | tree | notes |
| "1 + 2" | [:do,[:add, [:sexp,[:call, :__get_fixnum, 1]], [:sexp,[:call, :__get_fixnum, 2]]]] | |


0 comments on commit c0acf92

Please sign in to comment.