Sha256: 45f9a13ac00953fb6d09f4ac19997716387ecc959cc0ff2e22e7a47033d8b70a

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'
module Gisele::Language::Syntax
  describe TaskDef, "to_ast" do

    it 'parses an explicit definition as expected' do
      expr = <<-EXPR.strip
        task Task1
          fluent diagKnown {}, {}
          Task2
        end
      EXPR
      expected = \
        [:task_def, "Task1",
          [:fluent_def, "diagKnown", [:event_set], [:event_set], nil],
          [:task_call_st, "Task2"]]
      ast(expr, :task_def).should eq(expected)
    end

    it 'uses :nop_st if no statement' do
      expr = <<-EXPR.strip
        task Task1
          fluent diagKnown {}, {}
        end
      EXPR
      expected = \
        [:task_def, "Task1",
          [:fluent_def, "diagKnown", [:event_set], [:event_set], nil],
          [:nop_st]]
      ast(expr, :task_def).should eq(expected)
    end

    it 'uses :nop_st when empty' do
      expr = <<-EXPR.strip
        task Task1
        end
      EXPR
      expected = \
        [:task_def, "Task1",
          [:nop_st]]
      ast(expr, :task_def).should eq(expected)
    end

  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
gisele-language-0.6.0 spec/language/syntax/to_ast/test_task_def.rb
gisele-language-0.5.1 spec/language/syntax/to_ast/test_task_def.rb
gisele-language-0.5.0 spec/language/syntax/to_ast/test_task_def.rb
gisele-0.5.0 spec/unit/language/syntax/to_ast/test_task_def.rb