template-ruby-parser 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/code-ruby-parser.gemspec +3 -1
- data/lib/code-ruby-parser.rb +1 -7
- data/lib/template-ruby-parser.rb +1 -7
- data/template-ruby-parser.gemspec +3 -1
- metadata +18 -137
- data/.overcommit.yml +0 -4
- data/CHANGELOG.md +0 -31
- data/Gemfile +0 -5
- data/Gemfile.lock +0 -32
- data/bin/code-parser +0 -27
- data/bin/deploy +0 -16
- data/bin/format +0 -3
- data/bin/parse-docs +0 -6
- data/bin/template-parser +0 -27
- data/docs/class.code +0 -9
- data/docs/meetup.code +0 -14
- data/docs/precedence.code +0 -1
- data/docs/precedence.template +0 -35
- data/docs/rain.code +0 -23
- data/docs/slack.code +0 -17
- data/docs/stripe.code +0 -7
- data/docs/twitter.code +0 -7
- data/lib/code/parser/addition.rb +0 -13
- data/lib/code/parser/and_operator.rb +0 -13
- data/lib/code/parser/bitwise_and.rb +0 -13
- data/lib/code/parser/bitwise_or.rb +0 -13
- data/lib/code/parser/boolean.rb +0 -13
- data/lib/code/parser/call.rb +0 -183
- data/lib/code/parser/chained_call.rb +0 -41
- data/lib/code/parser/class.rb +0 -55
- data/lib/code/parser/code.rb +0 -20
- data/lib/code/parser/comments.rb +0 -46
- data/lib/code/parser/dictionnary.rb +0 -52
- data/lib/code/parser/equal.rb +0 -68
- data/lib/code/parser/equality.rb +0 -20
- data/lib/code/parser/error/syntax_error.rb +0 -36
- data/lib/code/parser/error.rb +0 -6
- data/lib/code/parser/function.rb +0 -118
- data/lib/code/parser/greater_than.rb +0 -13
- data/lib/code/parser/group.rb +0 -15
- data/lib/code/parser/if.rb +0 -81
- data/lib/code/parser/if_modifier.rb +0 -39
- data/lib/code/parser/list.rb +0 -20
- data/lib/code/parser/multiplication.rb +0 -13
- data/lib/code/parser/name.rb +0 -14
- data/lib/code/parser/negation.rb +0 -18
- data/lib/code/parser/not_keyword.rb +0 -26
- data/lib/code/parser/nothing.rb +0 -13
- data/lib/code/parser/number.rb +0 -39
- data/lib/code/parser/operation.rb +0 -65
- data/lib/code/parser/or_keyword.rb +0 -13
- data/lib/code/parser/or_operator.rb +0 -13
- data/lib/code/parser/power.rb +0 -33
- data/lib/code/parser/range.rb +0 -13
- data/lib/code/parser/rescue.rb +0 -38
- data/lib/code/parser/shift.rb +0 -13
- data/lib/code/parser/splat.rb +0 -35
- data/lib/code/parser/statement.rb +0 -9
- data/lib/code/parser/string.rb +0 -62
- data/lib/code/parser/ternary.rb +0 -73
- data/lib/code/parser/unary_minus.rb +0 -23
- data/lib/code/parser/while.rb +0 -36
- data/lib/code/parser.rb +0 -237
- data/lib/code.rb +0 -2
- data/lib/template/parser.rb +0 -32
- data/lib/template.rb +0 -2
- data/spec/code/parser/addition_spec.rb +0 -26
- data/spec/code/parser/and_operator_spec.rb +0 -26
- data/spec/code/parser/bitwise_and_spec.rb +0 -26
- data/spec/code/parser/bitwise_or_spec.rb +0 -26
- data/spec/code/parser/boolean_spec.rb +0 -13
- data/spec/code/parser/call_spec.rb +0 -52
- data/spec/code/parser/chained_call_spec.rb +0 -33
- data/spec/code/parser/class_spec.rb +0 -32
- data/spec/code/parser/code_spec.rb +0 -13
- data/spec/code/parser/dictionnary_spec.rb +0 -40
- data/spec/code/parser/equal_spec.rb +0 -42
- data/spec/code/parser/equality_spec.rb +0 -26
- data/spec/code/parser/function_spec.rb +0 -43
- data/spec/code/parser/greater_than_spec.rb +0 -26
- data/spec/code/parser/group_spec.rb +0 -13
- data/spec/code/parser/if_modifier_spec.rb +0 -26
- data/spec/code/parser/if_spec.rb +0 -39
- data/spec/code/parser/list_spec.rb +0 -27
- data/spec/code/parser/multiplication_spec.rb +0 -26
- data/spec/code/parser/negation_spec.rb +0 -13
- data/spec/code/parser/not_keyword_spec.rb +0 -21
- data/spec/code/parser/nothing_spec.rb +0 -20
- data/spec/code/parser/number_spec.rb +0 -24
- data/spec/code/parser/or_keyword_spec.rb +0 -26
- data/spec/code/parser/or_operator_spec.rb +0 -26
- data/spec/code/parser/power_spec.rb +0 -21
- data/spec/code/parser/range_spec.rb +0 -21
- data/spec/code/parser/rescue_spec.rb +0 -26
- data/spec/code/parser/shift_spec.rb +0 -26
- data/spec/code/parser/string_spec.rb +0 -28
- data/spec/code/parser/ternary_spec.rb +0 -26
- data/spec/code/parser/unary_minus_spec.rb +0 -21
- data/spec/code/parser/while_spec.rb +0 -32
- data/spec/code/parser_spec.rb +0 -13
- data/spec/spec_helper.rb +0 -6
- data/spec/template/parser_spec.rb +0 -13
@@ -1,43 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
[
|
7
|
-
"()=>{}",
|
8
|
-
"() => {}",
|
9
|
-
"(a, b) => { add(a, b) }",
|
10
|
-
"(a, b = 1, c:, d: 2, *e, **f) => { }",
|
11
|
-
"(a?, b! = 1, c?:, d?: 2, *e?, *f!, **g?, **h!) => { }"
|
12
|
-
].each do |input|
|
13
|
-
context input do
|
14
|
-
let!(:input) { input }
|
15
|
-
|
16
|
-
it { subject }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
[
|
21
|
-
"(/* cool */)=>{}",
|
22
|
-
"(/* cool */ a)=>{}",
|
23
|
-
"(/* cool */ a:)=>{}",
|
24
|
-
"(a /* cool */ )=>{}",
|
25
|
-
"(a /* cool */ :)=>{}",
|
26
|
-
"(a /* cool */ => 1)=>{}",
|
27
|
-
"(a = /* cool */ 1)=>{}",
|
28
|
-
"(a = 1 /* cool */)=>{}",
|
29
|
-
"(a, /* cool */ b)=>{}",
|
30
|
-
"(a, b /* cool */)=>{}",
|
31
|
-
"(a, b /* cool */ = 1)=>{}",
|
32
|
-
"(a, b: /* cool */)=>{}",
|
33
|
-
"() /* cool */ => {}",
|
34
|
-
"() => /* cool */ {}",
|
35
|
-
"() => { /* cool */ }"
|
36
|
-
].each do |input|
|
37
|
-
context input do
|
38
|
-
let!(:input) { input }
|
39
|
-
|
40
|
-
it { expect(subject.to_json).to include("cool") }
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
["a > b", "a > b > c", "a < b", "a >= b", "a <= b"].each do |input|
|
7
|
-
context input do
|
8
|
-
let!(:input) { input }
|
9
|
-
|
10
|
-
it { subject }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
[
|
15
|
-
"a /* cool */ > b",
|
16
|
-
"a < /* cool */ b",
|
17
|
-
"a > b < c /* cool */",
|
18
|
-
"a < b > /* cool */ c"
|
19
|
-
].each do |input|
|
20
|
-
context input do
|
21
|
-
let!(:input) { input }
|
22
|
-
|
23
|
-
it { expect(subject.to_json).to include("cool") }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
["a if b", "a if b if c", "a unless b"].each do |input|
|
7
|
-
context input do
|
8
|
-
let!(:input) { input }
|
9
|
-
|
10
|
-
it { subject }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
[
|
15
|
-
"a /* cool */ if b",
|
16
|
-
"a if /* cool */ b",
|
17
|
-
"a if b if c /* cool */",
|
18
|
-
"a unless b if /* cool */ c"
|
19
|
-
].each do |input|
|
20
|
-
context input do
|
21
|
-
let!(:input) { input }
|
22
|
-
|
23
|
-
it { expect(subject.to_json).to include("cool") }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/spec/code/parser/if_spec.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
[
|
7
|
-
"if b",
|
8
|
-
"if a b",
|
9
|
-
"if a end",
|
10
|
-
"if b a end",
|
11
|
-
"if a b else c",
|
12
|
-
"if a b elsif c d else e",
|
13
|
-
"if a b else if c d",
|
14
|
-
"if a b else unless c d"
|
15
|
-
].each do |input|
|
16
|
-
context input do
|
17
|
-
let!(:input) { input }
|
18
|
-
|
19
|
-
it { subject }
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
[
|
24
|
-
"if /* cool */ a",
|
25
|
-
"if a /* cool */ b",
|
26
|
-
"if a b /* cool */ else c",
|
27
|
-
"if a b else /* cool */ c",
|
28
|
-
"if a b elsif /* cool */ c d else e",
|
29
|
-
"if a b else /* cool */ if c d",
|
30
|
-
"if a b else if /* cool */ c d",
|
31
|
-
"if a b else unless /* cool */ c d"
|
32
|
-
].each do |input|
|
33
|
-
context input do
|
34
|
-
let!(:input) { input }
|
35
|
-
|
36
|
-
it { expect(subject.to_json).to include("cool") }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
["[]", "[1]", "[1,2]", "[1,[true]]"].each do |input|
|
7
|
-
context input do
|
8
|
-
let!(:input) { input }
|
9
|
-
|
10
|
-
it { subject }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
[
|
15
|
-
"[ /* cool */ ]",
|
16
|
-
"[ /* cool */ 1 ]",
|
17
|
-
"[ 1 /* cool */ ]",
|
18
|
-
"[ 1, /* cool */ 2 ]",
|
19
|
-
"[ 1, 2 /* cool */ ]"
|
20
|
-
].each do |input|
|
21
|
-
context input do
|
22
|
-
let!(:input) { input }
|
23
|
-
|
24
|
-
it { expect(subject.to_json).to include("cool") }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
["a * b", "a / b", "(a / b) / c", "a / (b / c)"].each do |input|
|
7
|
-
context input do
|
8
|
-
let!(:input) { input }
|
9
|
-
|
10
|
-
it { subject }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
[
|
15
|
-
"a /* cool */ * b",
|
16
|
-
"a * /* cool */ b",
|
17
|
-
"a * b * c /* cool */",
|
18
|
-
"a * b * /* cool */ c"
|
19
|
-
].each do |input|
|
20
|
-
context input do
|
21
|
-
let!(:input) { input }
|
22
|
-
|
23
|
-
it { expect(subject.to_json).to include("cool") }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
["not a", "not not a"].each do |input|
|
7
|
-
context input do
|
8
|
-
let!(:input) { input }
|
9
|
-
|
10
|
-
it { subject }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
["not /* cool */ a", "not not /* cool */ a"].each do |input|
|
15
|
-
context input do
|
16
|
-
let!(:input) { input }
|
17
|
-
|
18
|
-
it { expect(subject.to_json).to include("cool") }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
[
|
7
|
-
"nothing",
|
8
|
-
"null",
|
9
|
-
"nil",
|
10
|
-
" nothing",
|
11
|
-
" \n null ",
|
12
|
-
"nil \n "
|
13
|
-
].each do |input|
|
14
|
-
context input do
|
15
|
-
let!(:input) { input }
|
16
|
-
|
17
|
-
it { subject }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
%w[
|
7
|
-
1
|
8
|
-
100
|
9
|
-
0
|
10
|
-
1_000
|
11
|
-
1.34
|
12
|
-
1_000.300_400
|
13
|
-
0x10
|
14
|
-
0o10
|
15
|
-
0b10
|
16
|
-
0b1_0000_0000
|
17
|
-
].each do |input|
|
18
|
-
context input do
|
19
|
-
let!(:input) { input }
|
20
|
-
|
21
|
-
it { subject }
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
["a or b", "a and b", "a or b or c", "a and b and c"].each do |input|
|
7
|
-
context input do
|
8
|
-
let!(:input) { input }
|
9
|
-
|
10
|
-
it { subject }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
[
|
15
|
-
"a /* cool */ and b",
|
16
|
-
"a and /* cool */ b",
|
17
|
-
"a or b or c /* cool */",
|
18
|
-
"a or b or /* cool */ c"
|
19
|
-
].each do |input|
|
20
|
-
context input do
|
21
|
-
let!(:input) { input }
|
22
|
-
|
23
|
-
it { expect(subject.to_json).to include("cool") }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
["a || b", "a || b || c"].each do |input|
|
7
|
-
context input do
|
8
|
-
let!(:input) { input }
|
9
|
-
|
10
|
-
it { subject }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
[
|
15
|
-
"a /* cool */ || b",
|
16
|
-
"a || /* cool */ b",
|
17
|
-
"a || b || c /* cool */",
|
18
|
-
"a || b || /* cool */ c"
|
19
|
-
].each do |input|
|
20
|
-
context input do
|
21
|
-
let!(:input) { input }
|
22
|
-
|
23
|
-
it { expect(subject.to_json).to include("cool") }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
["a ** b", "a ** b ** c ** d"].each do |input|
|
7
|
-
context input do
|
8
|
-
let!(:input) { input }
|
9
|
-
|
10
|
-
it { subject }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
["1 /* cool */ ** 2", "1 ** /* cool */ 2"].each do |input|
|
15
|
-
context input do
|
16
|
-
let!(:input) { input }
|
17
|
-
|
18
|
-
it { expect(subject.to_json).to include("cool") }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
["a..b"].each do |input|
|
7
|
-
context input do
|
8
|
-
let!(:input) { input }
|
9
|
-
|
10
|
-
it { subject }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
["a /* cool */ .. b", "a .. /* cool */ b"].each do |input|
|
15
|
-
context input do
|
16
|
-
let!(:input) { input }
|
17
|
-
|
18
|
-
it { expect(subject.to_json).to include("cool") }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
["0/0 rescue a", "0/0 rescue 0/0 rescue 'nope'"].each do |input|
|
7
|
-
context input do
|
8
|
-
let!(:input) { input }
|
9
|
-
|
10
|
-
it { subject }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
[
|
15
|
-
"a /* cool */ rescue b",
|
16
|
-
"a rescue /* cool */ b",
|
17
|
-
"a rescue b /* cool */ rescue c",
|
18
|
-
"a rescue b eescue /* cool */ c"
|
19
|
-
].each do |input|
|
20
|
-
context input do
|
21
|
-
let!(:input) { input }
|
22
|
-
|
23
|
-
it { expect(subject.to_json).to include("cool") }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
["a << b", "a >> b", "(a << b) >> c", "a << (b >> c)"].each do |input|
|
7
|
-
context input do
|
8
|
-
let!(:input) { input }
|
9
|
-
|
10
|
-
it { subject }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
[
|
15
|
-
"a /* cool */ << b",
|
16
|
-
"a >> /* cool */ b",
|
17
|
-
"a << b >> c /* cool */",
|
18
|
-
"a >> b << /* cool */ c"
|
19
|
-
].each do |input|
|
20
|
-
context input do
|
21
|
-
let!(:input) { input }
|
22
|
-
|
23
|
-
it { expect(subject.to_json).to include("cool") }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
[
|
7
|
-
"''",
|
8
|
-
'""',
|
9
|
-
":a",
|
10
|
-
":even?",
|
11
|
-
"'Hello Dorian'",
|
12
|
-
'"Hello Dorian"',
|
13
|
-
"'Hello \\' Dorian'",
|
14
|
-
'"Hello \\" Dorian"',
|
15
|
-
"'Hello \\{name}'",
|
16
|
-
'"Hello \\{name}',
|
17
|
-
"'Hello {name}'",
|
18
|
-
'"Hello {name}',
|
19
|
-
'"Hello \\n\\a\\{"',
|
20
|
-
"'Hello \\n\\a\\{'"
|
21
|
-
].each do |input|
|
22
|
-
context input do
|
23
|
-
let!(:input) { input }
|
24
|
-
|
25
|
-
it { subject }
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
["a ? b : c", "a ? b", "a ? b ? c : d : e", "a ? b ? c : d"].each do |input|
|
7
|
-
context input do
|
8
|
-
let!(:input) { input }
|
9
|
-
|
10
|
-
it { subject }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
[
|
15
|
-
"a /* cool */ ? b : c",
|
16
|
-
"a ? /* cool */ b",
|
17
|
-
"a ? b /* cool */ ? c : d : e",
|
18
|
-
"a ? b ? /* cool */ c : d"
|
19
|
-
].each do |input|
|
20
|
-
context input do
|
21
|
-
let!(:input) { input }
|
22
|
-
|
23
|
-
it { expect(subject.to_json).to include("cool") }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
%w[-1 +a -+--1].each do |input|
|
7
|
-
context input do
|
8
|
-
let!(:input) { input }
|
9
|
-
|
10
|
-
it { subject }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
["- /* cool */ 1"].each do |input|
|
15
|
-
context input do
|
16
|
-
let!(:input) { input }
|
17
|
-
|
18
|
-
it { expect(subject.to_json).to include("cool") }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Code::Parser do
|
4
|
-
subject { ::Code::Parser.parse(input) }
|
5
|
-
|
6
|
-
[
|
7
|
-
"while false",
|
8
|
-
"while false a end",
|
9
|
-
"while false a",
|
10
|
-
"until true",
|
11
|
-
"until true a",
|
12
|
-
"until true a end"
|
13
|
-
].each do |input|
|
14
|
-
context input do
|
15
|
-
let!(:input) { input }
|
16
|
-
|
17
|
-
it { subject }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
[
|
22
|
-
"while /* cool */ a",
|
23
|
-
"while a /* cool */ b",
|
24
|
-
"until a b /* cool */ end"
|
25
|
-
].each do |input|
|
26
|
-
context input do
|
27
|
-
let!(:input) { input }
|
28
|
-
|
29
|
-
it { expect(subject.to_json).to include("cool") }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
data/spec/code/parser_spec.rb
DELETED
data/spec/spec_helper.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe ::Template::Parser do
|
4
|
-
subject { ::Template::Parser.parse(input) }
|
5
|
-
|
6
|
-
["Hello", "Hello {name}", "Hello \\{name}"].each do |input|
|
7
|
-
context input do
|
8
|
-
let!(:input) { input }
|
9
|
-
|
10
|
-
it { expect { subject }.to_not raise_error }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|