Sha256: 447db21b3a1b7d06be0e6481df335847a7516a82d41287c115493671484027b7

Contents?: true

Size: 884 Bytes

Versions: 6

Compression:

Stored size: 884 Bytes

Contents

dir = File.dirname(__FILE__)
require "#{dir}/../test_helper"

describe "A terminal parse failure" do
  def setup
    @input = "test input"
    @failure = Runtime::TerminalParseFailure.new(@input, 1, "foo")
  end
  
  it "is == to a parse failure at the same index expecting the same string" do
    @failure.should == Runtime::TerminalParseFailure.new(@input, 1, "foo")
  end
  
  it "is eql to a parse failure at the same index expecting the same string" do
    @failure.should eql(Runtime::TerminalParseFailure.new(@input, 1, "foo"))
    @failure.hash.should == Runtime::TerminalParseFailure.new(@input, 1, "foo").hash
  end
  
  it "is considered identical to another failure with the same index and expected string in an array" do        
    [Runtime::TerminalParseFailure.new(@input, 1, "foo"), Runtime::TerminalParseFailure.new(@input, 1, "foo")].uniq.size.should == 1
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
treetop-1.0.2 test/parser/terminal_parse_failure_test.rb
treetop-1.1.0 test/parser/terminal_parse_failure_test.rb
treetop-1.0.0 test/parser/terminal_parse_failure_test.rb
treetop-1.0.1 test/parser/terminal_parse_failure_test.rb
treetop-1.1.1 test/parser/terminal_parse_failure_test.rb
treetop-1.1.2 test/parser/terminal_parse_failure_test.rb