Sha256: 1f4dd6b3965c60050880cfc5621ad06db06c02bef6f3579faaef53c50509dfbb

Contents?: true

Size: 665 Bytes

Versions: 3

Compression:

Stored size: 665 Bytes

Contents

require 'spec_helper'

describe Xdrgen::Parser, ".parse" do

  it "can parse all of the fixtures" do
    results = parser_fixture_paths.map do |path|
                content = IO.read(path)
                {path:path}.merge parse(content)
              end

    failed = results.select{|r| !r[:success]}

    if failed.any?
      failures = failed.map{|r| "\t#{r[:path]} failed on line #{r[:failure_line]}"}
      fail "couldn't parse:\n#{failures.join("\n")}"
    end
  end

  def parse(content)
    begin
      subject.parse(content)
      {success: true}
    rescue Xdrgen::ParseError
      {success: false, failure_line: subject.failure_line}
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xdrgen-0.1.1 spec/lib/xdrgen/parser_spec.rb
xdrgen-0.1.0 spec/lib/xdrgen/parser_spec.rb
xdrgen-0.0.1 spec/lib/xdrgen/parser_spec.rb