antelope 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +25 -23
  3. data/.rspec +3 -3
  4. data/.travis.yml +10 -9
  5. data/.yardopts +7 -7
  6. data/CONTRIBUTING.md +38 -38
  7. data/GENERATORS.md +124 -124
  8. data/Gemfile +7 -7
  9. data/LICENSE.txt +22 -22
  10. data/README.md +104 -104
  11. data/Rakefile +2 -2
  12. data/TODO.md +58 -58
  13. data/antelope.gemspec +28 -28
  14. data/bin/antelope +7 -7
  15. data/examples/deterministic.ace +35 -35
  16. data/examples/example.ace +51 -50
  17. data/examples/example.err +192 -0
  18. data/examples/{example.output → example.inf} +384 -385
  19. data/examples/liquidscript.ace +233 -162
  20. data/examples/simple.ace +22 -22
  21. data/lib/antelope/ace/compiler.rb +334 -334
  22. data/lib/antelope/ace/errors.rb +48 -48
  23. data/lib/antelope/ace/grammar/generation.rb +80 -80
  24. data/lib/antelope/ace/grammar/loading.rb +53 -53
  25. data/lib/antelope/ace/grammar/precedences.rb +68 -65
  26. data/lib/antelope/ace/grammar/productions.rb +156 -150
  27. data/lib/antelope/ace/grammar/symbols.rb +66 -66
  28. data/lib/antelope/ace/grammar.rb +69 -69
  29. data/lib/antelope/ace/precedence.rb +61 -61
  30. data/lib/antelope/ace/production.rb +57 -57
  31. data/lib/antelope/ace/scanner/argument.rb +57 -57
  32. data/lib/antelope/ace/scanner/first.rb +89 -89
  33. data/lib/antelope/ace/scanner/second.rb +177 -177
  34. data/lib/antelope/ace/scanner/third.rb +27 -27
  35. data/lib/antelope/ace/scanner.rb +134 -134
  36. data/lib/antelope/ace/token/epsilon.rb +24 -24
  37. data/lib/antelope/ace/token/error.rb +26 -26
  38. data/lib/antelope/ace/token/nonterminal.rb +17 -17
  39. data/lib/antelope/ace/token/terminal.rb +17 -17
  40. data/lib/antelope/ace/token.rb +238 -238
  41. data/lib/antelope/ace.rb +53 -53
  42. data/lib/antelope/cli.rb +55 -55
  43. data/lib/antelope/errors.rb +8 -8
  44. data/lib/antelope/generation/constructor/first.rb +88 -88
  45. data/lib/antelope/generation/constructor/follow.rb +103 -103
  46. data/lib/antelope/generation/constructor/nullable.rb +64 -64
  47. data/lib/antelope/generation/constructor.rb +126 -126
  48. data/lib/antelope/generation/errors.rb +17 -17
  49. data/lib/antelope/generation/null.rb +13 -13
  50. data/lib/antelope/generation/recognizer/rule.rb +216 -216
  51. data/lib/antelope/generation/recognizer/state.rb +130 -130
  52. data/lib/antelope/generation/recognizer.rb +180 -180
  53. data/lib/antelope/generation/tableizer.rb +175 -154
  54. data/lib/antelope/generation.rb +15 -15
  55. data/lib/antelope/generator/base.rb +264 -264
  56. data/lib/antelope/generator/c.rb +11 -11
  57. data/lib/antelope/generator/c_header.rb +105 -105
  58. data/lib/antelope/generator/c_source.rb +39 -39
  59. data/lib/antelope/generator/error.rb +34 -0
  60. data/lib/antelope/generator/group.rb +57 -57
  61. data/lib/antelope/generator/html.rb +51 -0
  62. data/lib/antelope/generator/info.rb +47 -0
  63. data/lib/antelope/generator/null.rb +18 -18
  64. data/lib/antelope/generator/output.rb +17 -49
  65. data/lib/antelope/generator/ruby.rb +79 -79
  66. data/lib/antelope/generator/templates/c_header.ant +36 -36
  67. data/lib/antelope/generator/templates/c_source.ant +202 -202
  68. data/lib/antelope/generator/templates/error.ant +33 -0
  69. data/lib/antelope/generator/templates/html/antelope.css +1 -0
  70. data/lib/antelope/generator/templates/html/antelope.html +1 -0
  71. data/lib/antelope/generator/templates/html/antelope.js +1 -0
  72. data/lib/antelope/generator/templates/html/css.ant +53 -0
  73. data/lib/antelope/generator/templates/html/html.ant +82 -0
  74. data/lib/antelope/generator/templates/html/js.ant +9 -0
  75. data/lib/antelope/generator/templates/info.ant +53 -0
  76. data/lib/antelope/generator/templates/ruby.ant +178 -146
  77. data/lib/antelope/generator.rb +66 -63
  78. data/lib/antelope/template/compiler.rb +78 -78
  79. data/lib/antelope/template/errors.rb +9 -9
  80. data/lib/antelope/template/scanner.rb +109 -109
  81. data/lib/antelope/template.rb +65 -60
  82. data/lib/antelope/version.rb +6 -6
  83. data/lib/antelope.rb +13 -13
  84. data/optimizations.txt +42 -0
  85. data/spec/antelope/ace/compiler_spec.rb +60 -60
  86. data/spec/antelope/ace/scanner_spec.rb +27 -27
  87. data/spec/antelope/constructor_spec.rb +133 -136
  88. data/spec/antelope/template_spec.rb +50 -49
  89. data/spec/fixtures/simple.ace +22 -22
  90. data/spec/spec_helper.rb +39 -39
  91. data/spec/support/benchmark_helper.rb +5 -5
  92. data/spec/support/grammar_helper.rb +15 -15
  93. data/subl/Ace (Ruby).JSON-tmLanguage +94 -94
  94. data/subl/Ace (Ruby).tmLanguage +153 -153
  95. metadata +17 -6
  96. data/lib/antelope/generator/templates/output.ant +0 -68
@@ -1,60 +1,60 @@
1
- describe Ace::Compiler do
2
- let :file do
3
- <<-DOC
4
- %{
5
- test
6
- %}
7
-
8
- %require "#{VERSION}"
9
- %language "ruby"
10
-
11
- %terminal NUMBER
12
- %terminal SEMICOLON ";"
13
- %terminal ADD "+"
14
- %terminal LPAREN "("
15
- %terminal RPAREN ")"
16
-
17
- %%
18
-
19
- s: e
20
- e: t ADD e
21
- t: NUMBER | LPAREN e RPAREN
22
-
23
- %%
24
-
25
- hello
26
- DOC
27
- end
28
-
29
- let :tokens do
30
- Ace::Scanner.scan(file)
31
- end
32
-
33
- let :compiler do
34
- Ace::Compiler.new(tokens)
35
- end
36
-
37
- subject do
38
- compiler.compile
39
- compiler
40
- end
41
-
42
- its(:body) { should =~ /test/ }
43
- its(:body) { should =~ /hello/ }
44
- its(:options) { should have_key :type }
45
-
46
- it "should have the proper terminals" do
47
- expect(subject.options[:terminals].map(&:first)).to eq [:NUMBER,
48
- :SEMICOLON, :ADD, :LPAREN, :RPAREN]
49
- end
50
-
51
- context "with an unmatched version" do
52
- let :file do "%require \"0.0.0\"\n%%\n%%\n" end
53
-
54
- it "should raise an error" do
55
- expect {
56
- subject
57
- }.to raise_error(Ace::IncompatibleVersionError)
58
- end
59
- end
60
- end
1
+ describe Ace::Compiler do
2
+ let :file do
3
+ <<-DOC
4
+ %{
5
+ test
6
+ %}
7
+
8
+ %require "#{VERSION}"
9
+ %language "ruby"
10
+
11
+ %terminal NUMBER
12
+ %terminal SEMICOLON ";"
13
+ %terminal ADD "+"
14
+ %terminal LPAREN "("
15
+ %terminal RPAREN ")"
16
+
17
+ %%
18
+
19
+ s: e
20
+ e: t ADD e
21
+ t: NUMBER | LPAREN e RPAREN
22
+
23
+ %%
24
+
25
+ hello
26
+ DOC
27
+ end
28
+
29
+ let :tokens do
30
+ Ace::Scanner.scan(file)
31
+ end
32
+
33
+ let :compiler do
34
+ Ace::Compiler.new(tokens)
35
+ end
36
+
37
+ subject do
38
+ compiler.compile
39
+ compiler
40
+ end
41
+
42
+ its(:body) { should =~ /test/ }
43
+ its(:body) { should =~ /hello/ }
44
+ its(:options) { should have_key :type }
45
+
46
+ it "should have the proper terminals" do
47
+ expect(subject.options[:terminals].map(&:first)).to eq [:NUMBER,
48
+ :SEMICOLON, :ADD, :LPAREN, :RPAREN]
49
+ end
50
+
51
+ context "with an unmatched version" do
52
+ let :file do "%require \"0.0.0\"\n%%\n%%\n" end
53
+
54
+ it "should raise an error" do
55
+ expect {
56
+ subject
57
+ }.to raise_error(Ace::IncompatibleVersionError)
58
+ end
59
+ end
60
+ end
@@ -1,27 +1,27 @@
1
- describe Ace::Scanner do
2
-
3
- it "properly scans" do
4
- expect(scan("%test \"a\" hi\n%%\nt: d { { } }\n%%\nhi\n")).to eq [
5
- [:directive, "test", ["a", "hi"]],
6
- [:second],
7
- [:label, "t", nil],
8
- [:part, "d", nil],
9
- [:block, "{ { } }"],
10
- [:third],
11
- [:copy, "\nhi\n"]
12
- ]
13
- end
14
-
15
- it "throws an error" do
16
- expect {
17
- scan("% %% %% ")
18
- }.to raise_error(Ace::SyntaxError)
19
- end
20
-
21
- def scan(source)
22
- Timeout.timeout(5) do
23
- Ace::Scanner.scan(source)
24
- end
25
- end
26
-
27
- end
1
+ describe Ace::Scanner do
2
+
3
+ it "properly scans" do
4
+ expect(scan("%test \"a\" hi\n%%\nt: d { { } }\n%%\nhi\n")).to eq [
5
+ [:directive, "test", ["a", "hi"]],
6
+ [:second],
7
+ [:label, "t", nil],
8
+ [:part, "d", nil],
9
+ [:block, "{ { } }"],
10
+ [:third],
11
+ [:copy, "\nhi\n"]
12
+ ]
13
+ end
14
+
15
+ it "throws an error" do
16
+ expect {
17
+ scan("% %% %% ")
18
+ }.to raise_error(Ace::SyntaxError)
19
+ end
20
+
21
+ def scan(source)
22
+ Timeout.timeout(5) do
23
+ Ace::Scanner.scan(source)
24
+ end
25
+ end
26
+
27
+ end
@@ -1,136 +1,133 @@
1
- describe Generation::Constructor do
2
- let(:grammar) { double("grammar") }
3
- let(:terminal) { token(:TERMINAL) }
4
- let(:epsilon) { token(:epsilon) }
5
-
6
- subject { described_class.new(grammar) }
7
-
8
- context "#nullable?" do
9
- context "when given an epsilon token" do
10
- it "returns true" do
11
- expect(subject.nullable?(epsilon)).to be true
12
- end
13
- end
14
-
15
- context "when given a terminal" do
16
- it "returns false" do
17
- expect(subject.nullable?(terminal)).to be false
18
- end
19
- end
20
-
21
- context "when given an array" do
22
- context "with one of the elements not nullable" do
23
- it "returns false" do
24
- expect(subject.nullable?([terminal, epsilon])).to be false
25
- end
26
- end
27
-
28
- context "with all of the elements nullable" do
29
- it "returns true" do
30
- expect(subject.nullable?([epsilon, epsilon])).to be true
31
- end
32
- end
33
- end
34
-
35
- context "when given a nonterminal" do
36
- let(:grammar) { with_recognizer }
37
-
38
- context "with no nullable productions" do
39
- let(:nonterminal) { Ace::Token::Nonterminal.new(:l) }
40
-
41
- it "returns false" do
42
- expect(subject.nullable?(nonterminal)).to be false
43
- end
44
- end
45
-
46
- context "with a nullable production" do
47
- let(:nonterminal) { Ace::Token::Nonterminal.new(:e) }
48
-
49
- it "returns true" do
50
- expect(subject.nullable?(nonterminal)).to be true
51
- end
52
- end
53
- end
54
-
55
- context "when given a bad argument" do
56
- it "raises an error" do
57
- expect { subject.nullable?(nil) }.to raise_error(ArgumentError)
58
- end
59
- end
60
- end
61
-
62
- context "#first" do
63
- context "when given an epsilon token" do
64
- it "generates an empty set" do
65
- expect(subject.first(epsilon)).to eq Set.new
66
- end
67
- end
68
-
69
- context "when given a terminal" do
70
- it "generates a set" do
71
- expect(subject.first(terminal)).to eq [terminal].to_set
72
- end
73
- end
74
-
75
- context "when given an array" do
76
- let(:terminal2) { token(:terminal, :TERMINAL2) }
77
-
78
- it "generates a set" do
79
- expect(subject.first([epsilon, terminal])).
80
- to eq [terminal].to_set
81
- expect(subject.first([terminal, terminal2])).
82
- to eq [terminal].to_set
83
- end
84
- end
85
-
86
- context "when given a nonterminal" do
87
- let(:grammar) { with_recognizer }
88
- let(:nonterminal) { token(:nonterminal, :e) }
89
-
90
- before do
91
- p grammar.terminals
92
- end
93
- it "generates a set" do
94
- expect(subject.first(nonterminal)).
95
- to eq [token(:terminal, :IDENT), token(:terminal, :STAR, "*")].to_set
96
- end
97
- end
98
-
99
- context "when given a bad argument" do
100
- it "raises an error" do
101
- expect { subject.first(nil) }.to raise_error(ArgumentError)
102
- end
103
- end
104
- end
105
-
106
- context "#follow" do
107
- context "when given a bad argument" do
108
- it "raises an error" do
109
- expect { subject.follow(nil) }.to raise_error(ArgumentError)
110
- end
111
- end
112
-
113
- context "when given a nonterminal" do
114
- let(:grammar) { with_recognizer }
115
- let(:nonterminal) { token(:nonterminal, :l) }
116
-
117
- before do
118
- subject.productions.merge grammar.productions.values.flatten
119
- end
120
-
121
- it "generates a set" do
122
- expect(subject.follow(nonterminal)).to eq [
123
- token(:terminal, :EQUALS, "="),
124
- token(:terminal, :"$end")
125
- ].to_set
126
- end
127
- end
128
- end
129
-
130
-
131
-
132
- def token(type, name = nil, value = nil, ttype = nil, id = nil)
133
- type = Ace::Token.const_get(type.to_s.capitalize)
134
- type.new(name, ttype, id, value)
135
- end
136
- end
1
+ describe Generation::Constructor do
2
+ let(:grammar) { double("grammar") }
3
+ let(:terminal) { token(:TERMINAL) }
4
+ let(:epsilon) { token(:epsilon) }
5
+
6
+ subject { described_class.new(grammar) }
7
+
8
+ context "#nullable?" do
9
+ context "when given an epsilon token" do
10
+ it "returns true" do
11
+ expect(subject.nullable?(epsilon)).to be true
12
+ end
13
+ end
14
+
15
+ context "when given a terminal" do
16
+ it "returns false" do
17
+ expect(subject.nullable?(terminal)).to be false
18
+ end
19
+ end
20
+
21
+ context "when given an array" do
22
+ context "with one of the elements not nullable" do
23
+ it "returns false" do
24
+ expect(subject.nullable?([terminal, epsilon])).to be false
25
+ end
26
+ end
27
+
28
+ context "with all of the elements nullable" do
29
+ it "returns true" do
30
+ expect(subject.nullable?([epsilon, epsilon])).to be true
31
+ end
32
+ end
33
+ end
34
+
35
+ context "when given a nonterminal" do
36
+ let(:grammar) { with_recognizer }
37
+
38
+ context "with no nullable productions" do
39
+ let(:nonterminal) { Ace::Token::Nonterminal.new(:l) }
40
+
41
+ it "returns false" do
42
+ expect(subject.nullable?(nonterminal)).to be false
43
+ end
44
+ end
45
+
46
+ context "with a nullable production" do
47
+ let(:nonterminal) { Ace::Token::Nonterminal.new(:e) }
48
+
49
+ it "returns true" do
50
+ expect(subject.nullable?(nonterminal)).to be true
51
+ end
52
+ end
53
+ end
54
+
55
+ context "when given a bad argument" do
56
+ it "raises an error" do
57
+ expect { subject.nullable?(nil) }.to raise_error(ArgumentError)
58
+ end
59
+ end
60
+ end
61
+
62
+ context "#first" do
63
+ context "when given an epsilon token" do
64
+ it "generates an empty set" do
65
+ expect(subject.first(epsilon)).to eq Set.new
66
+ end
67
+ end
68
+
69
+ context "when given a terminal" do
70
+ it "generates a set" do
71
+ expect(subject.first(terminal)).to eq [terminal].to_set
72
+ end
73
+ end
74
+
75
+ context "when given an array" do
76
+ let(:terminal2) { token(:terminal, :TERMINAL2) }
77
+
78
+ it "generates a set" do
79
+ expect(subject.first([epsilon, terminal])).
80
+ to eq [terminal].to_set
81
+ expect(subject.first([terminal, terminal2])).
82
+ to eq [terminal].to_set
83
+ end
84
+ end
85
+
86
+ context "when given a nonterminal" do
87
+ let(:grammar) { with_recognizer }
88
+ let(:nonterminal) { token(:nonterminal, :e) }
89
+
90
+ it "generates a set" do
91
+ expect(subject.first(nonterminal)).
92
+ to eq [token(:terminal, :IDENT), token(:terminal, :STAR, "*")].to_set
93
+ end
94
+ end
95
+
96
+ context "when given a bad argument" do
97
+ it "raises an error" do
98
+ expect { subject.first(nil) }.to raise_error(ArgumentError)
99
+ end
100
+ end
101
+ end
102
+
103
+ context "#follow" do
104
+ context "when given a bad argument" do
105
+ it "raises an error" do
106
+ expect { subject.follow(nil) }.to raise_error(ArgumentError)
107
+ end
108
+ end
109
+
110
+ context "when given a nonterminal" do
111
+ let(:grammar) { with_recognizer }
112
+ let(:nonterminal) { token(:nonterminal, :l) }
113
+
114
+ before do
115
+ subject.productions.merge grammar.productions.values.flatten
116
+ end
117
+
118
+ it "generates a set" do
119
+ expect(subject.follow(nonterminal)).to eq [
120
+ token(:terminal, :EQUALS, "="),
121
+ token(:terminal, :"$end")
122
+ ].to_set
123
+ end
124
+ end
125
+ end
126
+
127
+
128
+
129
+ def token(type, name = nil, value = nil, ttype = nil, id = nil)
130
+ type = Ace::Token.const_get(type.to_s.capitalize)
131
+ type.new(name, ttype, id, value)
132
+ end
133
+ end
@@ -1,49 +1,50 @@
1
- describe Template do
2
-
3
- let(:content) { "hello {{ world }} test" }
4
-
5
- subject { Template.new(content) }
6
-
7
- it "generates ruby code" do
8
- expect(subject.parse).to eq %Q(_out ||= ""\n_out << "hello "\nworld\n_out << " test"\n_out\n)
9
- end
10
-
11
- context "when the tag is on its own line" do
12
-
13
- let :content do
14
- <<-TEST
15
- hello
16
- {{= something }}
17
- world
18
-
19
- {{ thing }}
20
- a
21
-
22
- TEST
23
- end
24
-
25
- it "removes surrounding whitespace" do
26
- expect(subject.parse).to eq <<-TEST
27
- _out ||= ""
28
- _out << "hello"
29
- _out << begin
30
- something
31
- end.to_s
32
- _out << "\\nworld\\n"
33
- thing
34
- _out << "\\na\\n\\n"
35
- _out
36
- TEST
37
- end
38
-
39
- it "runs in ruby" do
40
- object = Object.new
41
- result = nil
42
- def object.something; "-" end
43
- def object.thing; end
44
-
45
- expect { result = object.instance_eval(subject.parse) }.to_not raise_error
46
- expect(result).to eq "hello-\nworld\n\na\n\n"
47
- end
48
- end
49
- end
1
+ describe Template do
2
+
3
+ let(:content) { "hello {{ world }} test" }
4
+
5
+ subject { Template.new(content) }
6
+
7
+ it "generates ruby code" do
8
+ expect(subject.parse).to eq %Q(# encoding: utf-8\n_out ||= ""\n_out << "hello "\n world\n_out << " test"\n_out\n)
9
+ end
10
+
11
+ context "when the tag is on its own line" do
12
+
13
+ let :content do
14
+ <<-TEST
15
+ hello
16
+ {{= something }}
17
+ world
18
+
19
+ {{ thing }}
20
+ a
21
+
22
+ TEST
23
+ end
24
+
25
+ it "removes surrounding whitespace" do
26
+ expect(subject.parse).to eq <<-TEST
27
+ # encoding: utf-8
28
+ _out ||= ""
29
+ _out << "hello"
30
+ _out << begin
31
+ something
32
+ end.to_s
33
+ _out << "\\nworld\\n"
34
+ thing
35
+ _out << "\\na\\n\\n"
36
+ _out
37
+ TEST
38
+ end
39
+
40
+ it "runs in ruby" do
41
+ object = Object.new
42
+ result = nil
43
+ def object.something; "-" end
44
+ def object.thing; end
45
+
46
+ expect { result = object.instance_eval(subject.parse) }.to_not raise_error
47
+ expect(result).to eq "hello-\nworld\n\na\n\n"
48
+ end
49
+ end
50
+ end
@@ -1,22 +1,22 @@
1
- %language <ruby>
2
-
3
- %terminal IDENT
4
- %terminal STAR "*"
5
- %terminal EQUALS "="
6
-
7
- %%
8
-
9
- e: l EQUALS r
10
- | r
11
- | nothing
12
-
13
- l: IDENT
14
- | STAR r
15
-
16
- r: l
17
-
18
- %%
19
-
20
- class SimpleParser
21
- %{write}
22
- end
1
+ %language <ruby>
2
+
3
+ %terminal IDENT
4
+ %terminal STAR "*"
5
+ %terminal EQUALS "="
6
+
7
+ %%
8
+
9
+ e: l EQUALS r
10
+ | r
11
+ | nothing
12
+
13
+ l: IDENT
14
+ | STAR r
15
+
16
+ r: l
17
+
18
+ %%
19
+
20
+ class SimpleParser
21
+ %{write}
22
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,39 +1,39 @@
1
- require "rubygems"
2
- require "bundler/setup"
3
- Bundler.setup
4
-
5
- require "timeout"
6
- require "benchmark"
7
- require "simplecov"
8
- require "coveralls"
9
-
10
- SimpleCov.formatter = Coveralls::SimpleCov::Formatter
11
- SimpleCov.start do
12
- add_filter 'spec'
13
-
14
- end
15
-
16
- require "rspec/its"
17
- require "antelope"
18
-
19
- include Antelope
20
-
21
- Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each { |f| require f }
22
-
23
- # This file was generated by the `rspec --init` command. Conventionally, all
24
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
25
- # Require this file using `require "spec_helper"` to ensure that it is only
26
- # loaded once.
27
- #
28
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
29
- RSpec.configure do |config|
30
- config.run_all_when_everything_filtered = true
31
-
32
- # Run specs in random order to surface order dependencies. If you find an
33
- # order dependency and want to debug it, you can fix the order by providing
34
- # the seed, which is printed after each run.
35
- # --seed 1234
36
- config.order = 'random'
37
- config.include BenchmarkHelper
38
- config.include GrammarHelper
39
- end
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+ Bundler.setup
4
+
5
+ require "timeout"
6
+ require "benchmark"
7
+ require "simplecov"
8
+ require "coveralls"
9
+
10
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
11
+ SimpleCov.start do
12
+ add_filter 'spec'
13
+
14
+ end
15
+
16
+ require "rspec/its"
17
+ require "antelope"
18
+
19
+ include Antelope
20
+
21
+ Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each { |f| require f }
22
+
23
+ # This file was generated by the `rspec --init` command. Conventionally, all
24
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
25
+ # Require this file using `require "spec_helper"` to ensure that it is only
26
+ # loaded once.
27
+ #
28
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
29
+ RSpec.configure do |config|
30
+ config.run_all_when_everything_filtered = true
31
+
32
+ # Run specs in random order to surface order dependencies. If you find an
33
+ # order dependency and want to debug it, you can fix the order by providing
34
+ # the seed, which is printed after each run.
35
+ # --seed 1234
36
+ config.order = 'random'
37
+ config.include BenchmarkHelper
38
+ config.include GrammarHelper
39
+ end
@@ -1,5 +1,5 @@
1
- module BenchmarkHelper
2
- def benchmark
3
- Benchmark.realtime(&Proc.new)
4
- end
5
- end
1
+ module BenchmarkHelper
2
+ def benchmark
3
+ Benchmark.realtime(&Proc.new)
4
+ end
5
+ end