gisele 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -1
- data/Gemfile +4 -7
- data/Gemfile.lock +19 -19
- data/Rakefile +0 -4
- data/examples/merge/BreastCancer.dot +30 -0
- data/examples/merge/BreastCancer.gif +0 -0
- data/examples/merge/BreastCancer.gis +17 -0
- data/examples/merge/Merge.dot +46 -0
- data/examples/merge/Merge.gif +0 -0
- data/examples/merge/RectalCancer.dot +22 -0
- data/examples/merge/RectalCancer.gif +0 -0
- data/examples/merge/RectalCancer.gis +15 -0
- data/gisele.gemspec +3 -6
- data/gisele.noespec +11 -19
- data/lib/gisele.rb +0 -13
- data/lib/gisele/loader.rb +2 -3
- data/lib/gisele/version.rb +1 -1
- data/spec/command/main/gisele_version.stdout +1 -1
- data/spec/spec_helper.rb +0 -17
- data/tasks/gem.rake +9 -4
- metadata +65 -231
- data/lib/gisele/language.rb +0 -31
- data/lib/gisele/language/ast/bool_and.rb +0 -14
- data/lib/gisele/language/ast/bool_expr.rb +0 -22
- data/lib/gisele/language/ast/bool_not.rb +0 -14
- data/lib/gisele/language/ast/bool_or.rb +0 -14
- data/lib/gisele/language/ast/case_st.rb +0 -14
- data/lib/gisele/language/ast/else_clause.rb +0 -14
- data/lib/gisele/language/ast/elsif_clause.rb +0 -14
- data/lib/gisele/language/ast/if_st.rb +0 -14
- data/lib/gisele/language/ast/node.rb +0 -35
- data/lib/gisele/language/ast/task_call_st.rb +0 -14
- data/lib/gisele/language/ast/var_ref.rb +0 -14
- data/lib/gisele/language/ast/when_clause.rb +0 -14
- data/lib/gisele/language/ast/while_st.rb +0 -14
- data/lib/gisele/language/grammar.citrus +0 -236
- data/lib/gisele/language/grammar.sexp.yml +0 -83
- data/lib/gisele/language/processors.rb +0 -4
- data/lib/gisele/language/processors/elsif_flattener.rb +0 -36
- data/lib/gisele/language/processors/if_to_case.rb +0 -65
- data/lib/gisele/language/processors/scoping_helper.rb +0 -32
- data/lib/gisele/language/processors/sugar_removal.rb +0 -17
- data/lib/gisele/language/syntax/bool_and.rb +0 -14
- data/lib/gisele/language/syntax/bool_expr.rb +0 -14
- data/lib/gisele/language/syntax/bool_lit.rb +0 -14
- data/lib/gisele/language/syntax/bool_not.rb +0 -14
- data/lib/gisele/language/syntax/bool_or.rb +0 -14
- data/lib/gisele/language/syntax/bool_paren.rb +0 -14
- data/lib/gisele/language/syntax/case_st.rb +0 -19
- data/lib/gisele/language/syntax/else_clause.rb +0 -14
- data/lib/gisele/language/syntax/elsif_clause.rb +0 -16
- data/lib/gisele/language/syntax/event_set.rb +0 -15
- data/lib/gisele/language/syntax/fluent_def.rb +0 -18
- data/lib/gisele/language/syntax/if_st.rb +0 -18
- data/lib/gisele/language/syntax/implicit_seq_st.rb +0 -16
- data/lib/gisele/language/syntax/node.rb +0 -40
- data/lib/gisele/language/syntax/par_st.rb +0 -14
- data/lib/gisele/language/syntax/seq_st.rb +0 -14
- data/lib/gisele/language/syntax/st_list.rb +0 -14
- data/lib/gisele/language/syntax/task_call_st.rb +0 -14
- data/lib/gisele/language/syntax/task_def.rb +0 -18
- data/lib/gisele/language/syntax/trackvar_def.rb +0 -19
- data/lib/gisele/language/syntax/unit_def.rb +0 -14
- data/lib/gisele/language/syntax/var_ref.rb +0 -14
- data/lib/gisele/language/syntax/when_clause.rb +0 -16
- data/lib/gisele/language/syntax/while_st.rb +0 -16
- data/spec/unit/language/ast/test_bool_expr.rb +0 -50
- data/spec/unit/language/grammar_sexp/test_case_st.rb +0 -20
- data/spec/unit/language/grammar_sexp/test_event_set.rb +0 -14
- data/spec/unit/language/grammar_sexp/test_fluent_def.rb +0 -18
- data/spec/unit/language/grammar_sexp/test_initially.rb +0 -18
- data/spec/unit/language/grammar_sexp/test_nop_st.rb +0 -10
- data/spec/unit/language/grammar_sexp/test_when_clause.rb +0 -12
- data/spec/unit/language/processors/test_elsif_flattener.rb +0 -94
- data/spec/unit/language/processors/test_if_to_case.rb +0 -105
- data/spec/unit/language/processors/test_scoping_helper.rb +0 -45
- data/spec/unit/language/syntax/grammar/test_bool_expr.rb +0 -34
- data/spec/unit/language/syntax/grammar/test_boolean_literal.rb +0 -17
- data/spec/unit/language/syntax/grammar/test_case_st.rb +0 -60
- data/spec/unit/language/syntax/grammar/test_event.rb +0 -18
- data/spec/unit/language/syntax/grammar/test_event_name.rb +0 -21
- data/spec/unit/language/syntax/grammar/test_event_set.rb +0 -26
- data/spec/unit/language/syntax/grammar/test_fluent_def.rb +0 -21
- data/spec/unit/language/syntax/grammar/test_if_st.rb +0 -21
- data/spec/unit/language/syntax/grammar/test_par_st.rb +0 -11
- data/spec/unit/language/syntax/grammar/test_process_statement.rb +0 -19
- data/spec/unit/language/syntax/grammar/test_seq_st.rb +0 -11
- data/spec/unit/language/syntax/grammar/test_spaces.rb +0 -19
- data/spec/unit/language/syntax/grammar/test_spacing.rb +0 -17
- data/spec/unit/language/syntax/grammar/test_task_def.rb +0 -35
- data/spec/unit/language/syntax/grammar/test_task_name.rb +0 -19
- data/spec/unit/language/syntax/grammar/test_task_start_or_end.rb +0 -17
- data/spec/unit/language/syntax/grammar/test_trackvar_def.rb +0 -21
- data/spec/unit/language/syntax/grammar/test_unit_def.rb +0 -29
- data/spec/unit/language/syntax/grammar/test_variable_name.rb +0 -51
- data/spec/unit/language/syntax/grammar/test_when_clause.rb +0 -21
- data/spec/unit/language/syntax/grammar/test_while_st.rb +0 -11
- data/spec/unit/language/syntax/to_ast/test_bool_expr.rb +0 -32
- data/spec/unit/language/syntax/to_ast/test_case_st.rb +0 -47
- data/spec/unit/language/syntax/to_ast/test_else_clause.rb +0 -13
- data/spec/unit/language/syntax/to_ast/test_elsif_clause.rb +0 -15
- data/spec/unit/language/syntax/to_ast/test_event_set.rb +0 -24
- data/spec/unit/language/syntax/to_ast/test_fluent_def.rb +0 -26
- data/spec/unit/language/syntax/to_ast/test_if_st.rb +0 -39
- data/spec/unit/language/syntax/to_ast/test_par_st.rb +0 -12
- data/spec/unit/language/syntax/to_ast/test_seq_st.rb +0 -12
- data/spec/unit/language/syntax/to_ast/test_task_call_st.rb +0 -10
- data/spec/unit/language/syntax/to_ast/test_task_def.rb +0 -44
- data/spec/unit/language/syntax/to_ast/test_trackvar_def.rb +0 -26
- data/spec/unit/language/syntax/to_ast/test_unit_def.rb +0 -28
- data/spec/unit/language/syntax/to_ast/test_var_ref.rb +0 -12
- data/spec/unit/language/syntax/to_ast/test_when_clause.rb +0 -15
- data/spec/unit/language/syntax/to_ast/test_while_st.rb +0 -24
- data/spec/unit/language/test_syntax.rb +0 -51
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language
|
3
|
-
describe Grammar, 'spacing' do
|
4
|
-
|
5
|
-
it 'parses all kind of spaces' do
|
6
|
-
parse(' ', :spacing).should eq(' ')
|
7
|
-
parse("\t", :spacing).should eq("\t")
|
8
|
-
parse("\n", :spacing).should eq("\n")
|
9
|
-
parse(" \t\n", :spacing).should eq(" \t\n")
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'does not enforces mandatory spacing' do
|
13
|
-
parse('', :spacing).should eq('')
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language
|
3
|
-
describe Grammar, 'task_def' do
|
4
|
-
|
5
|
-
it 'parses a simple implicit task definition' do
|
6
|
-
taskdef = <<-TASKDEF.strip
|
7
|
-
task Process
|
8
|
-
Diagnosis
|
9
|
-
end
|
10
|
-
TASKDEF
|
11
|
-
parse(taskdef, :task_def).should eq(taskdef)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'allows any statement' do
|
15
|
-
taskdef = <<-TASKDEF.strip
|
16
|
-
task Process
|
17
|
-
while true Diagnosis end
|
18
|
-
end
|
19
|
-
TASKDEF
|
20
|
-
parse(taskdef, :task_def).should eq(taskdef)
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'supports optional variable definitions in the signature' do
|
24
|
-
taskdef = <<-TASKDEF.strip
|
25
|
-
task Process
|
26
|
-
fluent diagKnown {Diagnosis:start}, {} initially false
|
27
|
-
trackvar mplus {Diagnosis:end}
|
28
|
-
Diagnosis
|
29
|
-
end
|
30
|
-
TASKDEF
|
31
|
-
parse(taskdef, :task_def).should eq(taskdef)
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language
|
3
|
-
describe Grammar,'task_name' do
|
4
|
-
|
5
|
-
it 'parses correct task names' do
|
6
|
-
parse('A', :task_name).should eq('A')
|
7
|
-
parse('Diagnosis', :task_name).should eq('Diagnosis')
|
8
|
-
parse('TaskName', :task_name).should eq('TaskName')
|
9
|
-
parse('Task_Name', :task_name).should eq('Task_Name')
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'raises on invalid task names' do
|
13
|
-
lambda{
|
14
|
-
parse('not_a_task_name', :task_name)
|
15
|
-
}.should raise_error(Citrus::ParseError)
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language
|
3
|
-
describe Grammar, 'task_start_or_end' do
|
4
|
-
|
5
|
-
it 'parses correct event names' do
|
6
|
-
parse('Task:start', :task_start_or_end).should eq('Task:start')
|
7
|
-
parse('Task:end', :task_start_or_end).should eq('Task:end')
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'raises on simple task names' do
|
11
|
-
lambda{
|
12
|
-
parse('Task', :task_start_or_end)
|
13
|
-
}.should raise_error(Citrus::ParseError)
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language
|
3
|
-
describe Grammar, 'trackvar_def' do
|
4
|
-
|
5
|
-
it 'parses valid tracking variable definitions' do
|
6
|
-
defn = 'trackvar plateletLow {BloodTest:end}'
|
7
|
-
parse(defn, :trackvar_def).should eq(defn)
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'supports an optional initial value' do
|
11
|
-
defn = 'trackvar plateletLow {BloodTest:end} initially false'
|
12
|
-
parse(defn, :trackvar_def).should eq(defn)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'supports optional obsolete events' do
|
16
|
-
defn = 'trackvar plateletLow {BloodTest:end}, {Chemotherapy:end}'
|
17
|
-
parse(defn, :trackvar_def).should eq(defn)
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language
|
3
|
-
describe Grammar, 'unit' do
|
4
|
-
|
5
|
-
it 'parses a single task definition' do
|
6
|
-
expr = <<-UNIT.strip
|
7
|
-
task Task1 end
|
8
|
-
UNIT
|
9
|
-
parse(expr, :unit_def).should eq(expr)
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'accepts multiple task definitions' do
|
13
|
-
expr = <<-UNIT.strip
|
14
|
-
task Task1 end
|
15
|
-
task Task2 end
|
16
|
-
UNIT
|
17
|
-
parse(expr, :unit_def).should eq(expr)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'allows trailing spaces' do
|
21
|
-
expr = <<-UNIT
|
22
|
-
task Task1 end
|
23
|
-
task Task2 end
|
24
|
-
UNIT
|
25
|
-
parse(expr, :unit_def).should eq(expr)
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language
|
3
|
-
describe Grammar, 'variable_name' do
|
4
|
-
|
5
|
-
RESERVED_WORDS = [
|
6
|
-
"if",
|
7
|
-
"else",
|
8
|
-
"elsif",
|
9
|
-
"when",
|
10
|
-
"while",
|
11
|
-
"seq",
|
12
|
-
"par",
|
13
|
-
"task",
|
14
|
-
"refinement",
|
15
|
-
"fluent",
|
16
|
-
"trackvar",
|
17
|
-
"initially",
|
18
|
-
"end",
|
19
|
-
"not",
|
20
|
-
"or",
|
21
|
-
"and",
|
22
|
-
"true",
|
23
|
-
"false"
|
24
|
-
]
|
25
|
-
|
26
|
-
it 'parses correct variable names' do
|
27
|
-
parse('a', :variable_name).should eq('a')
|
28
|
-
parse('diagnosis', :variable_name).should eq('diagnosis')
|
29
|
-
parse('varName', :variable_name).should eq('varName')
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'does not allow reserved words' do
|
33
|
-
RESERVED_WORDS.each do |word|
|
34
|
-
lambda{
|
35
|
-
parse(word.to_s + " ", :variable_name)
|
36
|
-
}.should raise_error(Citrus::ParseError)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'allows a reserved word as prefix' do
|
41
|
-
parse('ifSomething', :variable_name).should eq('ifSomething')
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'raises on invalid variable names' do
|
45
|
-
lambda{
|
46
|
-
parse('NotAVarName', :variable_name)
|
47
|
-
}.should raise_error(Citrus::ParseError)
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language
|
3
|
-
describe Grammar, 'when_clause' do
|
4
|
-
|
5
|
-
it 'parses a single when clause statement' do
|
6
|
-
expr = 'when goodCond Task'
|
7
|
-
parse(expr, :when_clause).should eq(expr)
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'supports a boolean expression' do
|
11
|
-
expr = 'when not(goodCond and badCond) Task'
|
12
|
-
parse(expr, :when_clause).should eq(expr)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'supports an complex process statement' do
|
16
|
-
expr = 'when goodCond Task1 par Task2 Task3 end'
|
17
|
-
parse(expr, :when_clause).should eq(expr)
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language::Syntax
|
3
|
-
describe BoolExpr, "to_ast" do
|
4
|
-
|
5
|
-
it 'is correctly extended by Sexpr' do
|
6
|
-
ast("true", :bool_expr).should be_a(Gisele::Language::AST::BoolExpr)
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'returns expected ast on simple expressions' do
|
10
|
-
expected = \
|
11
|
-
[:bool_expr, [:bool_and, [:var_ref, "diagKnown"], [:var_ref, "platLow"]]]
|
12
|
-
ast("diagKnown and platLow", :bool_expr).should eq(expected)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'respects priorities' do
|
16
|
-
expected = [:bool_expr,
|
17
|
-
[:bool_or, [:bool_and, [:var_ref, "diagKnown"], [:var_ref, "platLow"]], [:var_ref, "platHigh"]]]
|
18
|
-
ast("diagKnown and platLow or platHigh", :bool_expr).should eq(expected)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'supports double negations' do
|
22
|
-
expected = [:bool_expr, [:bool_not, [:bool_not, [:var_ref, "diagKnown"]]]]
|
23
|
-
ast("not not(diagKnown)", :bool_expr).should eq(expected)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'makes boolean literals explicit' do
|
27
|
-
ast("true", :bool_expr).should eq([:bool_expr, [:bool_lit, true]])
|
28
|
-
ast("false", :bool_expr).should eq([:bool_expr, [:bool_lit, false]])
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language::Syntax
|
3
|
-
describe CaseSt, "to_ast" do
|
4
|
-
|
5
|
-
it 'arranges when clauses as expected' do
|
6
|
-
expr = <<-CASE_ST.strip
|
7
|
-
case
|
8
|
-
when good
|
9
|
-
Task1
|
10
|
-
when bad
|
11
|
-
Task2
|
12
|
-
end
|
13
|
-
CASE_ST
|
14
|
-
when_clause1 = ast("when good Task1", :when_clause)
|
15
|
-
when_clause2 = ast("when bad Task2", :when_clause)
|
16
|
-
expected = [:case_st, nil, when_clause1, when_clause2]
|
17
|
-
ast(expr, :case_st).should eq(expected)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'puts the else clause at the end' do
|
21
|
-
expr = <<-CASE_ST.strip
|
22
|
-
case
|
23
|
-
when good
|
24
|
-
Task1
|
25
|
-
else
|
26
|
-
Task2
|
27
|
-
end
|
28
|
-
CASE_ST
|
29
|
-
when_clause = ast("when good Task1", :when_clause)
|
30
|
-
else_clause = ast("else Task2", :else_clause)
|
31
|
-
expected = [:case_st, nil, when_clause, else_clause]
|
32
|
-
ast(expr, :case_st).should eq(expected)
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'supports an optional variable name' do
|
36
|
-
expr = <<-CASE_ST.strip
|
37
|
-
case someVariable
|
38
|
-
when good
|
39
|
-
Task1
|
40
|
-
end
|
41
|
-
CASE_ST
|
42
|
-
expected = [:var_ref, "someVariable"]
|
43
|
-
ast(expr, :case_st)[1].should eq(expected)
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language::Syntax
|
3
|
-
describe ElseClause, "to_ast" do
|
4
|
-
|
5
|
-
it 'parses as expected' do
|
6
|
-
expr = "else Task1"
|
7
|
-
expected = \
|
8
|
-
[:else_clause, [:task_call_st, "Task1"]]
|
9
|
-
ast(expr, :else_clause).should eq(expected)
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
13
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language::Syntax
|
3
|
-
describe ElsifClause, "to_ast" do
|
4
|
-
|
5
|
-
it 'parses as expected' do
|
6
|
-
expr = "elsif goodCond Task1"
|
7
|
-
expected = \
|
8
|
-
[:elsif_clause,
|
9
|
-
[:bool_expr, [:var_ref, "goodCond"]],
|
10
|
-
[:task_call_st, "Task1"]]
|
11
|
-
ast(expr, :elsif_clause).should eq(expected)
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language::Syntax
|
3
|
-
describe EventSet, "to_ast" do
|
4
|
-
|
5
|
-
it 'converts empty lists as expected' do
|
6
|
-
expr = '{ }'
|
7
|
-
expected = [:event_set]
|
8
|
-
ast(expr, :event_set).should eq(expected)
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'converts singleton lists as expected' do
|
12
|
-
expr = '{Diagnosis:start}'
|
13
|
-
expected = [:event_set, "Diagnosis:start"]
|
14
|
-
ast(expr, :event_set).should eq(expected)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'converts non empty lists as expected' do
|
18
|
-
expr = '{Diagnosis:start, an_event, another_one}'
|
19
|
-
expected = [:event_set, "Diagnosis:start", "an_event", "another_one"]
|
20
|
-
ast(expr, :event_set).should eq(expected)
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language::Syntax
|
3
|
-
describe FluentDef, "to_ast" do
|
4
|
-
|
5
|
-
it 'converts fluent definitions as expected' do
|
6
|
-
defn = "fluent diagKnown {Diagnosis:start, diagnosis}, {Treatment:end} initially false"
|
7
|
-
expected = [:fluent_def,
|
8
|
-
"diagKnown",
|
9
|
-
[:event_set, "Diagnosis:start", "diagnosis"],
|
10
|
-
[:event_set, "Treatment:end"],
|
11
|
-
false]
|
12
|
-
ast(defn, :fluent_def).should eq(expected)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'does not require the initial value' do
|
16
|
-
defn = "fluent diagKnown {Diagnosis:start, diagnosis}, {Treatment:end}"
|
17
|
-
expected = [:fluent_def,
|
18
|
-
"diagKnown",
|
19
|
-
[:event_set, "Diagnosis:start", "diagnosis"],
|
20
|
-
[:event_set, "Treatment:end"],
|
21
|
-
nil]
|
22
|
-
ast(defn, :fluent_def).should eq(expected)
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language::Syntax
|
3
|
-
describe IfSt, "to_ast" do
|
4
|
-
|
5
|
-
it 'parses as expected' do
|
6
|
-
expr = "if goodCond Task1 end"
|
7
|
-
expected = \
|
8
|
-
[:if_st,
|
9
|
-
[:bool_expr, [:var_ref, "goodCond"]],
|
10
|
-
[:task_call_st, "Task1"]]
|
11
|
-
ast(expr, :if_st).should eq(expected)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'supports a else clause' do
|
15
|
-
expr = "if goodCond Task1 else Task2 end"
|
16
|
-
expected = \
|
17
|
-
[:if_st,
|
18
|
-
[:bool_expr, [:var_ref, "goodCond"]],
|
19
|
-
[:task_call_st, "Task1"],
|
20
|
-
[:else_clause, [:task_call_st, "Task2"]] ]
|
21
|
-
ast(expr, :if_st).should eq(expected)
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'supports elsif clauses' do
|
25
|
-
expr = "if goodCond Task1 elsif otherCond Task2 elsif stillAnother Task3 else Task4 end"
|
26
|
-
expected = \
|
27
|
-
[:if_st,
|
28
|
-
[:bool_expr, [:var_ref, "goodCond"]], [:task_call_st, "Task1"],
|
29
|
-
[:elsif_clause,
|
30
|
-
[:bool_expr, [:var_ref, "otherCond"]], [:task_call_st, "Task2"]],
|
31
|
-
[:elsif_clause,
|
32
|
-
[:bool_expr, [:var_ref, "stillAnother"]], [:task_call_st, "Task3"]],
|
33
|
-
[:else_clause,
|
34
|
-
[:task_call_st, "Task4"]] ]
|
35
|
-
ast(expr, :if_st).should eq(expected)
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Gisele::Language::Syntax
|
3
|
-
describe ParSt, "to_ast" do
|
4
|
-
|
5
|
-
it 'parses as expected' do
|
6
|
-
expr = "par Task1 Task2 end"
|
7
|
-
expected = [:par_st, [:task_call_st, "Task1"], [:task_call_st, "Task2"]]
|
8
|
-
ast(expr, :par_st).should eq(expected)
|
9
|
-
end
|
10
|
-
|
11
|
-
end
|
12
|
-
end
|