Sha256: a8bdc4477bcd353671a63d735e2fec2edfb1fb96575256caaf7fa31b66ae83b7
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
require 'spec_helper' module Gisele::Language::Syntax describe IfSt, "to_ast" do it 'parses as expected' do expr = "if goodCond Task1 end" expected = \ [:if_st, [:bool_expr, [:var_ref, "goodCond"]], [:task_call_st, "Task1"]] ast(expr, :if_st).should eq(expected) end it 'supports a else clause' do expr = "if goodCond Task1 else Task2 end" expected = \ [:if_st, [:bool_expr, [:var_ref, "goodCond"]], [:task_call_st, "Task1"], [:else_clause, [:task_call_st, "Task2"]] ] ast(expr, :if_st).should eq(expected) end it 'supports elsif clauses' do expr = "if goodCond Task1 elsif otherCond Task2 elsif stillAnother Task3 else Task4 end" expected = \ [:if_st, [:bool_expr, [:var_ref, "goodCond"]], [:task_call_st, "Task1"], [:elsif_clause, [:bool_expr, [:var_ref, "otherCond"]], [:task_call_st, "Task2"]], [:elsif_clause, [:bool_expr, [:var_ref, "stillAnother"]], [:task_call_st, "Task3"]], [:else_clause, [:task_call_st, "Task4"]] ] ast(expr, :if_st).should eq(expected) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gisele-0.4.0 | spec/unit/language/syntax/to_ast/test_if_st.rb |
gisele-0.3.0 | spec/unit/language/syntax/to_ast/test_if_st.rb |