flavour_saver 0.3.9 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +47 -0
- data/CHANGELOG.md +46 -0
- data/Gemfile.lock +34 -62
- data/README.md +3 -10
- data/flavour_saver.gemspec +14 -9
- data/lib/flavour_saver/helpers.rb +28 -16
- data/lib/flavour_saver/lexer.rb +1 -1
- data/lib/flavour_saver/parser.rb +14 -8
- data/lib/flavour_saver/runtime.rb +7 -7
- data/lib/flavour_saver/version.rb +1 -1
- data/spec/acceptance/backtrack_spec.rb +1 -1
- data/spec/acceptance/comment_spec.rb +1 -1
- data/spec/acceptance/custom_block_helper_spec.rb +2 -2
- data/spec/acceptance/custom_helper_spec.rb +1 -1
- data/spec/acceptance/ensure_no_rce_spec.rb +2 -2
- data/spec/acceptance/handlebars_qunit_spec.rb +297 -219
- data/spec/acceptance/if_else_spec.rb +37 -6
- data/spec/acceptance/multi_level_with_spec.rb +1 -1
- data/spec/acceptance/one_character_identifier_spec.rb +2 -2
- data/spec/acceptance/raw_block_spec.rb +1 -1
- data/spec/acceptance/runtime_run_spec.rb +1 -1
- data/spec/acceptance/sections_spec.rb +3 -3
- data/spec/acceptance/segment_literals_spec.rb +3 -3
- data/spec/acceptance/simple_expression_spec.rb +3 -3
- data/spec/acceptance/subexpression_spec.rb +4 -5
- data/spec/acceptance/unless_spec.rb +48 -0
- data/spec/fixtures/if_else.hbs +3 -3
- data/spec/fixtures/unless.hbs +5 -0
- data/spec/lib/flavour_saver/lexer_spec.rb +67 -36
- data/spec/lib/flavour_saver/parser_spec.rb +91 -91
- data/spec/lib/flavour_saver/runtime_spec.rb +37 -37
- metadata +25 -72
- data/.travis.yml +0 -18
- data/Guardfile +0 -12
| @@ -3,15 +3,46 @@ require 'flavour_saver' | |
| 3 3 |  | 
| 4 4 | 
             
            describe 'Fixture: if_else.hbs' do
         | 
| 5 5 | 
             
              subject { Tilt.new(template).render(context).gsub(/[\s\r\n]+/, ' ').strip }
         | 
| 6 | 
            -
              let(:context) { Struct.new(: | 
| 6 | 
            +
              let(:context) { Struct.new(:value).new }
         | 
| 7 7 | 
             
              let(:template) { File.expand_path('../../fixtures/if_else.hbs', __FILE__) }
         | 
| 8 8 |  | 
| 9 | 
            -
              it  | 
| 10 | 
            -
                context. | 
| 11 | 
            -
                subject. | 
| 9 | 
            +
              it "renders the if block when given a string" do
         | 
| 10 | 
            +
                context.value = "Alan"
         | 
| 11 | 
            +
                expect(subject).to eq "The given value is truthy: Alan."
         | 
| 12 12 | 
             
              end
         | 
| 13 13 |  | 
| 14 | 
            -
              it  | 
| 15 | 
            -
                 | 
| 14 | 
            +
              it "renders the if block when given a number greater than zero" do
         | 
| 15 | 
            +
                context.value = 1
         | 
| 16 | 
            +
                expect(subject).to eq "The given value is truthy: 1."
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              it "renders the if block when given an array that is not empty" do
         | 
| 20 | 
            +
                context.value = [1]
         | 
| 21 | 
            +
                expect(subject).to eq "The given value is truthy: [1]."
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              it "renders the else block when given false" do
         | 
| 25 | 
            +
                context.value = false
         | 
| 26 | 
            +
                expect(subject).to eq "The given value is falsy: false."
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              it 'renders the else block when given nil' do
         | 
| 30 | 
            +
                context.value = nil
         | 
| 31 | 
            +
                expect(subject).to eq "The given value is falsy: ."
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
              it "renders the else block when given an empty string" do
         | 
| 35 | 
            +
                context.value = ""
         | 
| 36 | 
            +
                expect(subject).to eq "The given value is falsy: ."
         | 
| 37 | 
            +
              end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
              it "renders the else block when given a zero" do
         | 
| 40 | 
            +
                context.value = 0
         | 
| 41 | 
            +
                expect(subject).to eq "The given value is falsy: 0."
         | 
| 42 | 
            +
              end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
              it "renders the else block when given an empty array" do
         | 
| 45 | 
            +
                context.value = []
         | 
| 46 | 
            +
                expect(subject).to eq "The given value is falsy: []."
         | 
| 16 47 | 
             
              end
         | 
| 17 48 | 
             
            end
         | 
| @@ -9,7 +9,7 @@ describe 'Fixture: multi_level_with.hbs' do | |
| 9 9 | 
             
              it 'renders correctly when person has a name' do
         | 
| 10 10 | 
             
                context.person = Struct.new(:name).new('Alan')
         | 
| 11 11 | 
             
                context.company = Struct.new(:name).new('Rad, Inc.')
         | 
| 12 | 
            -
                subject. | 
| 12 | 
            +
                expect(subject).to eq 'Alan - Rad, Inc.'
         | 
| 13 13 | 
             
              end
         | 
| 14 14 |  | 
| 15 15 | 
             
            end
         | 
| @@ -7,7 +7,7 @@ describe 'Fixture: one_character_identifier.hbs' do | |
| 7 7 | 
             
              let(:context)  { double(:context) }
         | 
| 8 8 |  | 
| 9 9 | 
             
              it 'renders correctly' do
         | 
| 10 | 
            -
                context. | 
| 11 | 
            -
                subject. | 
| 10 | 
            +
                expect(context).to receive(:a).and_return('foo')
         | 
| 11 | 
            +
                expect(subject).to eq "foo"
         | 
| 12 12 | 
             
              end
         | 
| 13 13 | 
             
            end
         | 
| @@ -8,18 +8,18 @@ describe 'Fixture: sections.hbs' do | |
| 8 8 |  | 
| 9 9 | 
             
              it 'renders correctly when given a name' do
         | 
| 10 10 | 
             
                context.name = 'Alan'
         | 
| 11 | 
            -
                subject. | 
| 11 | 
            +
                expect(subject).to eq "Say hello to Alan."
         | 
| 12 12 | 
             
              end
         | 
| 13 13 |  | 
| 14 14 | 
             
              it 'renders correctly when given a list of names' do
         | 
| 15 15 | 
             
                context.names = ['Foo', 'Bar']
         | 
| 16 | 
            -
                subject. | 
| 16 | 
            +
                expect(subject).to eq "* Foo * Bar"
         | 
| 17 17 | 
             
              end
         | 
| 18 18 |  | 
| 19 19 | 
             
              it 'renders correctly when given an order' do
         | 
| 20 20 | 
             
                class Order; def number; 1234; end; end
         | 
| 21 21 | 
             
                context.order = Order.new
         | 
| 22 | 
            -
                subject. | 
| 22 | 
            +
                expect(subject).to eq 'Number: 1234'
         | 
| 23 23 | 
             
              end
         | 
| 24 24 | 
             
            end
         | 
| 25 25 |  | 
| @@ -17,10 +17,10 @@ describe FlavourSaver do | |
| 17 17 | 
             
                  foos = []
         | 
| 18 18 | 
             
                  foos << double(:foo)
         | 
| 19 19 | 
             
                  foos << double(:foo)
         | 
| 20 | 
            -
                  foos[1]. | 
| 20 | 
            +
                  expect(foos[1]).to receive(:bar).and_return('two')
         | 
| 21 21 |  | 
| 22 | 
            -
                  context. | 
| 23 | 
            -
                  subject. | 
| 22 | 
            +
                  allow(context).to receive(:foos).and_return(foos)
         | 
| 23 | 
            +
                  expect(subject).to eq 'two'
         | 
| 24 24 | 
             
                end
         | 
| 25 25 | 
             
              end
         | 
| 26 26 | 
             
            end
         | 
| @@ -7,11 +7,11 @@ describe 'Fixture: simple_expression.hbs' do | |
| 7 7 | 
             
              let(:context)  { double(:context) }
         | 
| 8 8 |  | 
| 9 9 | 
             
              it 'renders correctly' do
         | 
| 10 | 
            -
                context. | 
| 11 | 
            -
                subject. | 
| 10 | 
            +
                expect(context).to receive(:hello).and_return('hello world')
         | 
| 11 | 
            +
                expect(subject).to eq "hello world"
         | 
| 12 12 | 
             
              end
         | 
| 13 13 |  | 
| 14 14 | 
             
              it 'renders nothing if undefined' do
         | 
| 15 | 
            -
                subject. | 
| 15 | 
            +
                expect(subject).to eq ""
         | 
| 16 16 | 
             
              end
         | 
| 17 17 | 
             
            end
         | 
| @@ -11,18 +11,18 @@ describe 'Subexpressions' do | |
| 11 11 | 
             
              end
         | 
| 12 12 | 
             
              context "simple subexpression" do
         | 
| 13 13 | 
             
                let(:template) { "{{sum 1 (sum 1 1)}}" }
         | 
| 14 | 
            -
                specify{subject. | 
| 14 | 
            +
                specify{expect(subject).to eq "3"}
         | 
| 15 15 | 
             
              end
         | 
| 16 16 |  | 
| 17 17 | 
             
              context "nested subexpressions" do
         | 
| 18 18 | 
             
                let(:template) { "{{sum 1 (sum 1 (sum 1 1))}}" }
         | 
| 19 | 
            -
                specify{subject. | 
| 19 | 
            +
                specify{expect(subject).to eq "4"}
         | 
| 20 20 | 
             
              end
         | 
| 21 21 |  | 
| 22 22 | 
             
              context "subexpression as argument" do
         | 
| 23 23 | 
             
                before {FlavourSaver.register_helper(:cents) { |a| a[:total] + 10}}
         | 
| 24 24 | 
             
                let(:template) { "{{cents total=(sum 1 1)}}" }
         | 
| 25 | 
            -
                specify{subject. | 
| 25 | 
            +
                specify{expect(subject).to eq "12"}
         | 
| 26 26 | 
             
              end
         | 
| 27 27 |  | 
| 28 28 | 
             
              context "subexpression in block" do
         | 
| @@ -32,7 +32,6 @@ describe 'Subexpressions' do | |
| 32 32 | 
             
                  s
         | 
| 33 33 | 
             
                end}
         | 
| 34 34 | 
             
                let(:template) { "{{#repeat (sum 1 2)}}*{{/repeat}}" }
         | 
| 35 | 
            -
                specify{subject. | 
| 35 | 
            +
                specify{expect(subject).to eq "***"}
         | 
| 36 36 | 
             
              end
         | 
| 37 | 
            -
              
         | 
| 38 37 | 
             
            end
         | 
| @@ -0,0 +1,48 @@ | |
| 1 | 
            +
            require 'tilt'
         | 
| 2 | 
            +
            require 'flavour_saver'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe 'Fixture: unless.hbs' do
         | 
| 5 | 
            +
              subject { Tilt.new(template).render(context).gsub(/[\s\r\n]+/, ' ').strip }
         | 
| 6 | 
            +
              let(:context) { Struct.new(:value).new }
         | 
| 7 | 
            +
              let(:template) { File.expand_path('../../fixtures/unless.hbs', __FILE__) }
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              it "renders the unless block when given false" do
         | 
| 10 | 
            +
                context.value = false
         | 
| 11 | 
            +
                expect(subject).to eq "The given value is falsy: false."
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              it 'renders the unless block when given nil' do
         | 
| 15 | 
            +
                context.value = nil
         | 
| 16 | 
            +
                expect(subject).to eq "The given value is falsy: ."
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              it "renders the unless block when given an empty string" do
         | 
| 20 | 
            +
                context.value = ""
         | 
| 21 | 
            +
                expect(subject).to eq "The given value is falsy: ."
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              it "renders the unless block when given a zero" do
         | 
| 25 | 
            +
                context.value = 0
         | 
| 26 | 
            +
                expect(subject).to eq "The given value is falsy: 0."
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              it "renders the unless block when given an empty array" do
         | 
| 30 | 
            +
                context.value = []
         | 
| 31 | 
            +
                expect(subject).to eq "The given value is falsy: []."
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
              it "renders the else block when given a string" do
         | 
| 35 | 
            +
                context.value = "Alan"
         | 
| 36 | 
            +
                expect(subject).to eq "The given value is truthy: Alan."
         | 
| 37 | 
            +
              end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
              it "renders the else block when given a number greater than zero" do
         | 
| 40 | 
            +
                context.value = 1
         | 
| 41 | 
            +
                expect(subject).to eq "The given value is truthy: 1."
         | 
| 42 | 
            +
              end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
              it "renders the else block when given an array that is not empty" do
         | 
| 45 | 
            +
                context.value = [1]
         | 
| 46 | 
            +
                expect(subject).to eq "The given value is truthy: [1]."
         | 
| 47 | 
            +
              end
         | 
| 48 | 
            +
            end
         | 
    
        data/spec/fixtures/if_else.hbs
    CHANGED
    
    
| @@ -2,7 +2,7 @@ require 'flavour_saver/lexer' | |
| 2 2 |  | 
| 3 3 | 
             
            describe FlavourSaver::Lexer do
         | 
| 4 4 | 
             
              it 'is an RLTK lexer' do
         | 
| 5 | 
            -
                subject. | 
| 5 | 
            +
                expect(subject).to be_a(RLTK::Lexer)
         | 
| 6 6 | 
             
              end
         | 
| 7 7 |  | 
| 8 8 | 
             
              describe 'Tokens' do
         | 
| @@ -11,17 +11,17 @@ describe FlavourSaver::Lexer do | |
| 11 11 | 
             
                    subject { FlavourSaver::Lexer.lex "{{foo}}" }
         | 
| 12 12 |  | 
| 13 13 | 
             
                    it 'begins with an EXPRST' do
         | 
| 14 | 
            -
                      subject.first.type. | 
| 14 | 
            +
                      expect(subject.first.type).to eq :EXPRST
         | 
| 15 15 | 
             
                    end
         | 
| 16 16 |  | 
| 17 17 | 
             
                    it 'ends with an EXPRE' do
         | 
| 18 | 
            -
                      subject[-2].type. | 
| 18 | 
            +
                      expect(subject[-2].type).to eq :EXPRE
         | 
| 19 19 | 
             
                    end
         | 
| 20 20 |  | 
| 21 21 | 
             
                    it 'contains only the identifier "foo"' do
         | 
| 22 | 
            -
                      subject[1..-3].size. | 
| 23 | 
            -
                      subject[1].type. | 
| 24 | 
            -
                      subject[1].value. | 
| 22 | 
            +
                      expect(subject[1..-3].size).to eq 1
         | 
| 23 | 
            +
                      expect(subject[1].type).to eq :IDENT
         | 
| 24 | 
            +
                      expect(subject[1].value).to eq 'foo'
         | 
| 25 25 | 
             
                    end
         | 
| 26 26 | 
             
                  end
         | 
| 27 27 |  | 
| @@ -29,11 +29,11 @@ describe FlavourSaver::Lexer do | |
| 29 29 | 
             
                    subject { FlavourSaver::Lexer.lex "{{foo bar}}" }
         | 
| 30 30 |  | 
| 31 31 | 
             
                    it 'has tokens in the correct order' do
         | 
| 32 | 
            -
                      subject.map(&:type). | 
| 32 | 
            +
                      expect(subject.map(&:type)).to eq [ :EXPRST, :IDENT, :WHITE, :IDENT, :EXPRE, :EOS ]
         | 
| 33 33 | 
             
                    end
         | 
| 34 34 |  | 
| 35 35 | 
             
                    it 'has values in the correct order' do
         | 
| 36 | 
            -
                      subject.map(&:value).compact. | 
| 36 | 
            +
                      expect(subject.map(&:value).compact).to eq [ 'foo', 'bar' ]
         | 
| 37 37 | 
             
                    end
         | 
| 38 38 | 
             
                  end
         | 
| 39 39 |  | 
| @@ -41,11 +41,11 @@ describe FlavourSaver::Lexer do | |
| 41 41 | 
             
                    subject { FlavourSaver::Lexer.lex "{{foo \"bar\"}}" }
         | 
| 42 42 |  | 
| 43 43 | 
             
                    it 'has tokens in the correct order' do
         | 
| 44 | 
            -
                      subject.map(&:type). | 
| 44 | 
            +
                      expect(subject.map(&:type)).to eq [ :EXPRST, :IDENT, :WHITE, :STRING, :EXPRE, :EOS ]
         | 
| 45 45 | 
             
                    end
         | 
| 46 46 |  | 
| 47 47 | 
             
                    it 'has values in the correct order' do
         | 
| 48 | 
            -
                      subject.map(&:value).compact. | 
| 48 | 
            +
                      expect(subject.map(&:value).compact).to eq [ 'foo', 'bar' ]
         | 
| 49 49 | 
             
                    end
         | 
| 50 50 | 
             
                  end
         | 
| 51 51 |  | 
| @@ -53,11 +53,11 @@ describe FlavourSaver::Lexer do | |
| 53 53 | 
             
                    subject { FlavourSaver::Lexer.lex "{{foo (bar 'baz')}}" }
         | 
| 54 54 |  | 
| 55 55 | 
             
                    it 'has tokens in the correct order' do
         | 
| 56 | 
            -
                      subject.map(&:type). | 
| 56 | 
            +
                      expect(subject.map(&:type)).to eq  [ :EXPRST, :IDENT, :WHITE, :OPAR, :IDENT, :WHITE, :S_STRING, :CPAR, :EXPRE, :EOS ]
         | 
| 57 57 | 
             
                    end
         | 
| 58 58 |  | 
| 59 59 | 
             
                    it 'has values in the correct order' do
         | 
| 60 | 
            -
                      subject.map(&:value).compact. | 
| 60 | 
            +
                      expect(subject.map(&:value).compact).to eq [ 'foo', 'bar', 'baz' ]
         | 
| 61 61 | 
             
                    end
         | 
| 62 62 | 
             
                  end
         | 
| 63 63 |  | 
| @@ -65,13 +65,44 @@ describe FlavourSaver::Lexer do | |
| 65 65 | 
             
                    subject { FlavourSaver::Lexer.lex '{{foo bar="baz" hello="goodbye"}}' }
         | 
| 66 66 |  | 
| 67 67 | 
             
                    it 'has tokens in the correct order' do
         | 
| 68 | 
            -
                      subject.map(&:type). | 
| 68 | 
            +
                      expect(subject.map(&:type)).to eq [ :EXPRST, :IDENT, :WHITE, :IDENT, :EQ, :STRING, :WHITE, :IDENT, :EQ, :STRING, :EXPRE, :EOS ]
         | 
| 69 69 | 
             
                    end
         | 
| 70 70 |  | 
| 71 71 | 
             
                    it 'has values in the correct order' do
         | 
| 72 | 
            -
                      subject.map(&:value).compact. | 
| 72 | 
            +
                      expect(subject.map(&:value).compact).to eq [ 'foo', 'bar', 'baz', 'hello', 'goodbye' ]
         | 
| 73 | 
            +
                    end
         | 
| 74 | 
            +
                  end
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                  describe '{{0}}' do
         | 
| 77 | 
            +
                    subject { FlavourSaver::Lexer.lex "{{0}}" }
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                    it 'properly lexes the expression' do
         | 
| 80 | 
            +
                      expect(subject.map(&:type)).to eq(
         | 
| 81 | 
            +
                        [:EXPRST, :NUMBER, :EXPRE, :EOS]
         | 
| 82 | 
            +
                      )
         | 
| 73 83 | 
             
                    end
         | 
| 74 84 |  | 
| 85 | 
            +
                    it 'contains only the number "0"' do
         | 
| 86 | 
            +
                      expect(subject[1..-3].size).to eq 1
         | 
| 87 | 
            +
                      expect(subject[1].type).to eq :NUMBER
         | 
| 88 | 
            +
                      expect(subject[1].value).to eq '0'
         | 
| 89 | 
            +
                    end
         | 
| 90 | 
            +
                  end
         | 
| 91 | 
            +
             | 
| 92 | 
            +
                  describe '{{0.0123456789}}' do
         | 
| 93 | 
            +
                    subject { FlavourSaver::Lexer.lex "{{0.0123456789}}" }
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                    it 'properly lexes the expression' do
         | 
| 96 | 
            +
                      expect(subject.map(&:type)).to eq(
         | 
| 97 | 
            +
                        [:EXPRST, :NUMBER, :EXPRE, :EOS]
         | 
| 98 | 
            +
                      )
         | 
| 99 | 
            +
                    end
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                    it 'contains only the number "0.0123456789"' do
         | 
| 102 | 
            +
                      expect(subject[1..-3].size).to eq 1
         | 
| 103 | 
            +
                      expect(subject[1].type).to eq :NUMBER
         | 
| 104 | 
            +
                      expect(subject[1].value).to eq '0.0123456789'
         | 
| 105 | 
            +
                    end
         | 
| 75 106 | 
             
                  end
         | 
| 76 107 | 
             
                end
         | 
| 77 108 |  | 
| @@ -81,8 +112,8 @@ describe FlavourSaver::Lexer do | |
| 81 112 | 
             
                    ids = %w( _ __ __123__ __ABC__ ABC123 Abc134def )
         | 
| 82 113 | 
             
                    ids.each do |id|
         | 
| 83 114 | 
             
                      subject = FlavourSaver::Lexer.lex "{{#{id}}}"
         | 
| 84 | 
            -
                      subject[1].type. | 
| 85 | 
            -
                      subject[1].value. | 
| 115 | 
            +
                      expect(subject[1].type).to eq :IDENT
         | 
| 116 | 
            +
                      expect(subject[1].value).to eq id
         | 
| 86 117 | 
             
                    end
         | 
| 87 118 | 
             
                  end
         | 
| 88 119 |  | 
| @@ -90,8 +121,8 @@ describe FlavourSaver::Lexer do | |
| 90 121 | 
             
                    ids = %w( A-B 12_Mine - :example 0A test? )
         | 
| 91 122 | 
             
                    ids.each do |id|
         | 
| 92 123 | 
             
                      subject = FlavourSaver::Lexer.lex "{{#{id}}}"
         | 
| 93 | 
            -
                      subject[1].type. | 
| 94 | 
            -
                      subject[1].value. | 
| 124 | 
            +
                      expect(subject[1].type).to eq :LITERAL
         | 
| 125 | 
            +
                      expect(subject[1].value).to eq id
         | 
| 95 126 | 
             
                    end
         | 
| 96 127 | 
             
                  end
         | 
| 97 128 | 
             
                end
         | 
| @@ -100,11 +131,11 @@ describe FlavourSaver::Lexer do | |
| 100 131 | 
             
                  subject { FlavourSaver::Lexer.lex '{{foo bar=(baz qux)}}' }
         | 
| 101 132 |  | 
| 102 133 | 
             
                  it 'has tokens in the correct order' do
         | 
| 103 | 
            -
                    subject.map(&:type). | 
| 134 | 
            +
                    expect(subject.map(&:type)).to eq [:EXPRST, :IDENT, :WHITE, :IDENT, :EQ, :OPAR, :IDENT, :WHITE, :IDENT, :CPAR, :EXPRE, :EOS]
         | 
| 104 135 | 
             
                  end
         | 
| 105 136 |  | 
| 106 137 | 
             
                  it 'has values in the correct order' do
         | 
| 107 | 
            -
                    subject.map(&:value).compact. | 
| 138 | 
            +
                    expect(subject.map(&:value).compact).to eq [ 'foo', 'bar', 'baz', 'qux' ]
         | 
| 108 139 | 
             
                  end
         | 
| 109 140 | 
             
                end
         | 
| 110 141 |  | 
| @@ -112,7 +143,7 @@ describe FlavourSaver::Lexer do | |
| 112 143 | 
             
                  subject { FlavourSaver::Lexer.lex '{{else}}' }
         | 
| 113 144 |  | 
| 114 145 | 
             
                  it 'has tokens in the correct order' do
         | 
| 115 | 
            -
                    subject.map(&:type). | 
| 146 | 
            +
                    expect(subject.map(&:type)).to eq [ :EXPRST, :ELSE, :EXPRE, :EOS ]
         | 
| 116 147 | 
             
                  end
         | 
| 117 148 | 
             
                end
         | 
| 118 149 |  | 
| @@ -121,11 +152,11 @@ describe FlavourSaver::Lexer do | |
| 121 152 | 
             
                    subject { FlavourSaver::Lexer.lex "{{foo.bar}}" }
         | 
| 122 153 |  | 
| 123 154 | 
             
                    it 'has tokens in the correct order' do
         | 
| 124 | 
            -
                      subject.map(&:type). | 
| 155 | 
            +
                      expect(subject.map(&:type)).to eq [ :EXPRST, :IDENT, :DOT, :IDENT, :EXPRE, :EOS ]
         | 
| 125 156 | 
             
                    end
         | 
| 126 157 |  | 
| 127 158 | 
             
                    it 'has the correct values' do
         | 
| 128 | 
            -
                      subject.map(&:value).compact. | 
| 159 | 
            +
                      expect(subject.map(&:value).compact).to eq ['foo', 'bar']
         | 
| 129 160 | 
             
                    end
         | 
| 130 161 | 
             
                  end
         | 
| 131 162 |  | 
| @@ -133,11 +164,11 @@ describe FlavourSaver::Lexer do | |
| 133 164 | 
             
                    subject { FlavourSaver::Lexer.lex "{{foo.[10].bar}}" }
         | 
| 134 165 |  | 
| 135 166 | 
             
                    it 'has tokens in the correct order' do
         | 
| 136 | 
            -
                      subject.map(&:type). | 
| 167 | 
            +
                      expect(subject.map(&:type)).to eq [ :EXPRST, :IDENT, :DOT, :LITERAL, :DOT, :IDENT, :EXPRE, :EOS ]
         | 
| 137 168 | 
             
                    end
         | 
| 138 169 |  | 
| 139 170 | 
             
                    it 'has the correct values' do
         | 
| 140 | 
            -
                      subject.map(&:value).compact. | 
| 171 | 
            +
                      expect(subject.map(&:value).compact).to eq ['foo', '10', 'bar']
         | 
| 141 172 | 
             
                    end
         | 
| 142 173 | 
             
                  end
         | 
| 143 174 |  | 
| @@ -145,11 +176,11 @@ describe FlavourSaver::Lexer do | |
| 145 176 | 
             
                    subject { FlavourSaver::Lexer.lex '{{foo.[he!@#$(&@klA)].bar}}' }
         | 
| 146 177 |  | 
| 147 178 | 
             
                    it 'has tokens in the correct order' do
         | 
| 148 | 
            -
                      subject.map(&:type). | 
| 179 | 
            +
                      expect(subject.map(&:type)).to eq [ :EXPRST, :IDENT, :DOT, :LITERAL, :DOT, :IDENT, :EXPRE, :EOS ]
         | 
| 149 180 | 
             
                    end
         | 
| 150 181 |  | 
| 151 182 | 
             
                    it 'has the correct values' do
         | 
| 152 | 
            -
                      subject.map(&:value).compact. | 
| 183 | 
            +
                      expect(subject.map(&:value).compact).to eq ['foo', 'he!@#$(&@klA)', 'bar']
         | 
| 153 184 | 
             
                    end
         | 
| 154 185 | 
             
                  end
         | 
| 155 186 | 
             
                end
         | 
| @@ -158,7 +189,7 @@ describe FlavourSaver::Lexer do | |
| 158 189 | 
             
                  subject { FlavourSaver::Lexer.lex "{{{foo}}}" }
         | 
| 159 190 |  | 
| 160 191 | 
             
                  it 'has tokens in the correct order' do
         | 
| 161 | 
            -
                    subject.map(&:type). | 
| 192 | 
            +
                    expect(subject.map(&:type)).to eq [ :TEXPRST, :IDENT, :TEXPRE, :EOS ]
         | 
| 162 193 | 
             
                  end
         | 
| 163 194 | 
             
                end
         | 
| 164 195 |  | 
| @@ -166,7 +197,7 @@ describe FlavourSaver::Lexer do | |
| 166 197 | 
             
                  subject { FlavourSaver::Lexer.lex "{{! WAT}}" }
         | 
| 167 198 |  | 
| 168 199 | 
             
                  it 'has tokens in the correct order' do
         | 
| 169 | 
            -
                    subject.map(&:type). | 
| 200 | 
            +
                    expect(subject.map(&:type)).to eq [ :EXPRST, :BANG, :COMMENT, :EXPRE, :EOS ]
         | 
| 170 201 | 
             
                  end
         | 
| 171 202 | 
             
                end
         | 
| 172 203 |  | 
| @@ -174,7 +205,7 @@ describe FlavourSaver::Lexer do | |
| 174 205 | 
             
                  subject { FlavourSaver::Lexer.lex "{{../foo}}" }
         | 
| 175 206 |  | 
| 176 207 | 
             
                  it 'has tokens in the correct order' do
         | 
| 177 | 
            -
                    subject.map(&:type). | 
| 208 | 
            +
                    expect(subject.map(&:type)).to eq [:EXPRST, :DOT, :DOT, :FWSL, :IDENT, :EXPRE, :EOS]
         | 
| 178 209 | 
             
                  end
         | 
| 179 210 | 
             
                end
         | 
| 180 211 |  | 
| @@ -182,7 +213,7 @@ describe FlavourSaver::Lexer do | |
| 182 213 | 
             
                  subject { FlavourSaver::Lexer.lex "{{foo}}\n{{bar}}\r{{baz}}" }
         | 
| 183 214 |  | 
| 184 215 | 
             
                  it 'has tokens in the correct order' do
         | 
| 185 | 
            -
                    subject.map(&:type). | 
| 216 | 
            +
                    expect(subject.map(&:type)).to eq [:EXPRST,:IDENT,:EXPRE,:OUT,:EXPRST,:IDENT,:EXPRE,:OUT,:EXPRST,:IDENT,:EXPRE,:EOS]
         | 
| 186 217 | 
             
                  end
         | 
| 187 218 | 
             
                end
         | 
| 188 219 |  | 
| @@ -191,7 +222,7 @@ describe FlavourSaver::Lexer do | |
| 191 222 |  | 
| 192 223 | 
             
                  describe '{{#foo}}{{bar}}{{/foo}}' do
         | 
| 193 224 | 
             
                    it 'has tokens in the correct order' do
         | 
| 194 | 
            -
                      subject.map(&:type). | 
| 225 | 
            +
                      expect(subject.map(&:type)).to eq [
         | 
| 195 226 | 
             
                        :EXPRST, :HASH, :IDENT, :EXPRE,
         | 
| 196 227 | 
             
                        :EXPRST, :IDENT, :EXPRE,
         | 
| 197 228 | 
             
                        :EXPRST, :FWSL, :IDENT, :EXPRE,
         | 
| @@ -200,7 +231,7 @@ describe FlavourSaver::Lexer do | |
| 200 231 | 
             
                    end
         | 
| 201 232 |  | 
| 202 233 | 
             
                    it 'has identifiers in the correct order' do
         | 
| 203 | 
            -
                      subject.map(&:value).compact. | 
| 234 | 
            +
                      expect(subject.map(&:value).compact).to eq [ 'foo', 'bar', 'foo' ]
         | 
| 204 235 | 
             
                    end
         | 
| 205 236 | 
             
                  end
         | 
| 206 237 | 
             
                end
         | 
| @@ -209,7 +240,7 @@ describe FlavourSaver::Lexer do | |
| 209 240 | 
             
                  subject { FlavourSaver::Lexer.lex "\r" }
         | 
| 210 241 |  | 
| 211 242 | 
             
                  it 'has tokens in the correct order' do
         | 
| 212 | 
            -
                    subject.map(&:type). | 
| 243 | 
            +
                    expect(subject.map(&:type)).to eq [:OUT,:EOS]
         | 
| 213 244 | 
             
                  end
         | 
| 214 245 | 
             
                end
         | 
| 215 246 |  | 
| @@ -217,7 +248,7 @@ describe FlavourSaver::Lexer do | |
| 217 248 | 
             
                  subject { FlavourSaver::Lexer.lex "\n" }
         | 
| 218 249 |  | 
| 219 250 | 
             
                  it 'has tokens in the correct order' do
         | 
| 220 | 
            -
                    subject.map(&:type). | 
| 251 | 
            +
                    expect(subject.map(&:type)).to eq [:OUT,:EOS]
         | 
| 221 252 | 
             
                  end
         | 
| 222 253 | 
             
                end
         | 
| 223 254 |  | 
| @@ -225,7 +256,7 @@ describe FlavourSaver::Lexer do | |
| 225 256 | 
             
                  subject { FlavourSaver::Lexer.lex "{" }
         | 
| 226 257 |  | 
| 227 258 | 
             
                  it 'has tokens in the correct order' do
         | 
| 228 | 
            -
                    subject.map(&:type). | 
| 259 | 
            +
                    expect(subject.map(&:type)).to eq [:OUT,:EOS]
         | 
| 229 260 | 
             
                  end
         | 
| 230 261 | 
             
                end
         | 
| 231 262 | 
             
              end
         |