Sha256: 2f5e21c0f3ac5c18e36eaba4c8e76d5d25414ee79e9c2450a8d9e8197c36eb75

Contents?: true

Size: 897 Bytes

Versions: 8

Compression:

Stored size: 897 Bytes

Contents

require_relative '../test-util'

class TestParser < Parslet::Parser
  include Pione::Parser::FeatureExprParser
end

describe 'Pione::Parser::FeatureExprParser' do
  describe 'feature_expr' do
    it 'should parse feature expressions' do
      strings = ['+A', '-A', '?A', '(+A)',
                 '+A & +A', '+A | +A', '?A & +A',
                 '(+A) & (+A)', '(+A | +A)',
                 '+A & (+A & -A)', '(+A & -A) & +A']
      strings.each do |s|
        should.not.raise(Parslet::ParseFailed) do
          TestParser.new.feature_expr.parse(s)
        end
      end
    end

    TestUtil::Parser.spec(Pione::Parser::FeatureExprParser, __FILE__, self)

    it 'should fail with other strings' do
      strings = ['A', '(-A', '?A)']
      strings.each do |s|
        should.raise(Parslet::ParseFailed) do
          TestParser.new.feature_expr.parse(s)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pione-0.2.2 test/parser/spec_feature-expr-parser.rb
pione-0.2.1 test/parser/spec_feature-expr-parser.rb
pione-0.2.0 test/parser/spec_feature-expr-parser.rb
pione-0.1.4 test/parser/spec_feature-expr-parser.rb
pione-0.1.3 test/parser/spec_feature-expr-parser.rb
pione-0.1.2 test/parser/spec_feature-expr-parser.rb
pione-0.1.1 test/parser/spec_feature-expr-parser.rb
pione-0.1.0 test/parser/spec_feature-expr-parser.rb