Sha256: 4041b7d0131e10b2e1a133d7599aa5ebd5f8552087e5fcddec5926ec088f2fe0
Contents?: true
Size: 1.25 KB
Versions: 28
Compression:
Stored size: 1.25 KB
Contents
require "spec_helper" require "expressir/express_exp/parser" RSpec.describe Expressir::ExpressExp::Parser do describe ".head_source" do it "contains original head source" do input = File.read(sample_file) repo = Expressir::ExpressExp::Parser.from_file(sample_file) repo.schemas[0].tap do |x| start_index = x.source.index("SCHEMA") stop_index = x.source.index(";") + ";".length - 1 expected_result = x.source[start_index..stop_index] expect(x.head_source).to eq(expected_result) end repo.schemas[1].tap do |x| start_index = x.source.index("SCHEMA") stop_index = x.source.index(";") + ";".length - 1 expected_result = x.source[start_index..stop_index] expect(x.head_source).to eq(expected_result) end repo.schemas[2].tap do |x| start_index = x.source.index("SCHEMA") stop_index = x.source.index("REFERENCE FROM contract_schema;") + "REFERENCE FROM contract_schema;".length - 1 expected_result = x.source[start_index..stop_index] expect(x.head_source).to eq(expected_result) end end end def sample_file @sample_file ||= Expressir.root_path.join( "original", "examples", "syntax", "source.exp" ) end end
Version data entries
28 entries across 28 versions & 1 rubygems