expressir 0.2.27-arm64-darwin → 1.0.0-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +3 -3
- data/.gitignore +2 -2
- data/demo.rb +5 -5
- data/exe/format +8 -8
- data/exe/format-test +11 -11
- data/expressir.gemspec +0 -1
- data/lib/expressir.rb +0 -1
- data/lib/expressir/cli.rb +0 -6
- data/lib/expressir/{express_exp → express}/2.4/express_parser.bundle +0 -0
- data/lib/expressir/{express_exp → express}/2.5/express_parser.bundle +0 -0
- data/lib/expressir/{express_exp → express}/2.6/express_parser.bundle +0 -0
- data/lib/expressir/{express_exp → express}/2.7/express_parser.bundle +0 -0
- data/lib/expressir/{express_exp → express}/3.0/express_parser.bundle +0 -0
- data/lib/expressir/{express_exp → express}/cache.rb +3 -6
- data/lib/expressir/{express_exp → express}/formatter.rb +72 -66
- data/lib/expressir/{express_exp → express}/hyperlink_formatter.rb +1 -1
- data/lib/expressir/{express_exp → express}/model_visitor.rb +1 -1
- data/lib/expressir/{express_exp → express}/parser.rb +3 -3
- data/lib/expressir/{express_exp → express}/resolve_references_model_visitor.rb +2 -2
- data/lib/expressir/{express_exp → express}/schema_head_formatter.rb +1 -1
- data/lib/expressir/{express_exp → express}/visitor.rb +21 -25
- data/lib/expressir/model.rb +2 -2
- data/lib/expressir/model/entity.rb +6 -6
- data/lib/expressir/model/model_element.rb +1 -1
- data/lib/expressir/model/rule.rb +3 -3
- data/lib/expressir/model/type.rb +6 -6
- data/lib/expressir/model/types/enumeration.rb +2 -4
- data/lib/expressir/model/types/select.rb +2 -4
- data/lib/expressir/model/{unique.rb → unique_rule.rb} +1 -1
- data/lib/expressir/model/{where.rb → where_rule.rb} +1 -1
- data/lib/expressir/version.rb +1 -1
- data/rakelib/cross-ruby.rake +1 -1
- data/spec/expressir/{express_exp → express}/cache_spec.rb +9 -9
- data/spec/expressir/express/formatter_spec.rb +127 -0
- data/spec/expressir/{express_exp → express}/parser_spec.rb +23 -23
- data/spec/expressir/model/model_element_spec.rb +45 -45
- data/{original/examples → spec}/syntax/multiple.exp +0 -0
- data/{original/examples → spec}/syntax/multiple.yaml +4 -4
- data/{original/examples → spec}/syntax/multiple_formatted.exp +0 -0
- data/{original/examples → spec}/syntax/multiple_hyperlink_formatted.exp +0 -0
- data/{original/examples → spec}/syntax/multiple_schema_head_hyperlink_formatted.exp +0 -0
- data/{original/examples → spec}/syntax/remark.exp +0 -0
- data/{original/examples → spec}/syntax/remark.yaml +13 -13
- data/{original/examples → spec}/syntax/remark_formatted.exp +0 -0
- data/{original/examples → spec}/syntax/single.exp +0 -0
- data/{original/examples → spec}/syntax/single.yaml +1 -1
- data/{original/examples → spec}/syntax/single_formatted.exp +0 -0
- data/{original/examples → spec}/syntax/single_formatted.yaml +1 -1
- data/{original/examples → spec}/syntax/syntax.exp +10 -10
- data/{original/examples → spec}/syntax/syntax.yaml +106 -106
- data/{original/examples → spec}/syntax/syntax_formatted.exp +10 -10
- data/{original/examples → spec}/syntax/syntax_hyperlink_formatted.exp +10 -10
- data/{original/examples → spec}/syntax/syntax_schema_head_formatted.exp +0 -0
- metadata +37 -85
- data/lib/expressir/express.rb +0 -11
- data/lib/expressir/express/aggregate_dimension.rb +0 -38
- data/lib/expressir/express/attribute.rb +0 -15
- data/lib/expressir/express/comment.rb +0 -7
- data/lib/expressir/express/defined_type.rb +0 -36
- data/lib/expressir/express/derived.rb +0 -65
- data/lib/expressir/express/derived_aggregate.rb +0 -43
- data/lib/expressir/express/entity.rb +0 -137
- data/lib/expressir/express/explicit.rb +0 -70
- data/lib/expressir/express/explicit_aggregate.rb +0 -46
- data/lib/expressir/express/explicit_or_derived.rb +0 -16
- data/lib/expressir/express/global_rule.rb +0 -44
- data/lib/expressir/express/interface_specification.rb +0 -51
- data/lib/expressir/express/interfaced_item.rb +0 -38
- data/lib/expressir/express/inverse.rb +0 -46
- data/lib/expressir/express/inverse_aggregate.rb +0 -37
- data/lib/expressir/express/model_element.rb +0 -7
- data/lib/expressir/express/named_type.rb +0 -19
- data/lib/expressir/express/remark.rb +0 -8
- data/lib/expressir/express/repository.rb +0 -306
- data/lib/expressir/express/schema_definition.rb +0 -96
- data/lib/expressir/express/subtype_constraint.rb +0 -14
- data/lib/expressir/express/type.rb +0 -26
- data/lib/expressir/express/type_aggregate.rb +0 -42
- data/lib/expressir/express/type_enum.rb +0 -29
- data/lib/expressir/express/type_parser.rb +0 -45
- data/lib/expressir/express/type_select.rb +0 -82
- data/lib/expressir/express/unique_rule.rb +0 -35
- data/lib/expressir/express/where_rule.rb +0 -32
- data/lib/expressir/express_parser.rb +0 -30
- data/lib/expressir/parser.rb +0 -6
- data/lib/expressir/parser/owl_parser.rb +0 -8
- data/spec/acceptance/express_to_owl_spec.rb +0 -18
- data/spec/expressir/express/repository_spec.rb +0 -25
- data/spec/expressir/express_exp/formatter_spec.rb +0 -127
@@ -1,14 +0,0 @@
|
|
1
|
-
require "expressir/express/model_element"
|
2
|
-
|
3
|
-
module Expressir
|
4
|
-
module Express
|
5
|
-
class SubtypeConstraint < ModelElement
|
6
|
-
attr_accessor :name, :entity, :isAbs, :totalover, :expression
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@isAbs = false
|
10
|
-
@totalover = nil
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "expressir/express/defined_type"
|
2
|
-
|
3
|
-
module Expressir
|
4
|
-
module Express
|
5
|
-
class Type < DefinedType
|
6
|
-
attr_accessor :isBuiltin, :domain, :isFixed, :width, :precision
|
7
|
-
|
8
|
-
def initialize(options = {})
|
9
|
-
@isBuiltin = false
|
10
|
-
@isFixed = false
|
11
|
-
@width = nil
|
12
|
-
@precision = nil
|
13
|
-
@wheres = []
|
14
|
-
@selectedBy = []
|
15
|
-
|
16
|
-
super(options)
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def extract_type_attributes(document)
|
22
|
-
super(document)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require "expressir/express/type"
|
2
|
-
|
3
|
-
module Expressir
|
4
|
-
module Express
|
5
|
-
class TypeAggregate < Type
|
6
|
-
attr_accessor :rank, :dimensions
|
7
|
-
def initialize(options = {})
|
8
|
-
@rank = 0
|
9
|
-
@dimensions = []
|
10
|
-
@wheres = []
|
11
|
-
@selectedBy = []
|
12
|
-
|
13
|
-
super(options)
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def extract_type_attributes(document)
|
19
|
-
@name = document.first.attributes["name"].to_s
|
20
|
-
@dimensions = document.map do |aggregate|
|
21
|
-
Express::AggregateDimension.parse(aggregate)
|
22
|
-
end
|
23
|
-
|
24
|
-
@rank = @dimensions.size
|
25
|
-
extract_builtintype_attributes(document)
|
26
|
-
end
|
27
|
-
|
28
|
-
def extract_builtintype_attributes(document)
|
29
|
-
builtin_type = document.xpath("builtintype").first
|
30
|
-
|
31
|
-
if builtin_type
|
32
|
-
@isBuiltin = true
|
33
|
-
@domain = builtin_type.attributes["type"].to_s
|
34
|
-
@width = builtin_type.attributes["width"].to_s
|
35
|
-
@fixed = builtin_type.attributes["fixed"] == "YES"
|
36
|
-
@precision = builtin_type.attributes["precision"].to_s
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require "expressir/express/defined_type"
|
2
|
-
|
3
|
-
module Expressir
|
4
|
-
module Express
|
5
|
-
class TypeEnum < DefinedType
|
6
|
-
attr_accessor :items_array, :items, :extends, :extends_item,
|
7
|
-
:isExtensible, :allitems, :isBuiltin
|
8
|
-
|
9
|
-
def initialize(options = {})
|
10
|
-
@isBuiltin = false
|
11
|
-
@selectedBy = []
|
12
|
-
|
13
|
-
super(options)
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def extract_type_attributes(document)
|
19
|
-
if document.class == Nokogiri::XML::NodeSet
|
20
|
-
document = document.first
|
21
|
-
end
|
22
|
-
|
23
|
-
@items = document.attributes["items"]
|
24
|
-
@items_array = items.to_s.scan(/\w+/)
|
25
|
-
super(document)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require "expressir/express/type_enum"
|
2
|
-
require "expressir/express/type_select"
|
3
|
-
require "expressir/express/type_aggregate"
|
4
|
-
|
5
|
-
module Expressir
|
6
|
-
module Express
|
7
|
-
class TypeParser
|
8
|
-
def initialize(options = {})
|
9
|
-
@options = options
|
10
|
-
@schema = options.fetch(:schema, nil)
|
11
|
-
end
|
12
|
-
|
13
|
-
def parse
|
14
|
-
document = @options.fetch(:document, nil)
|
15
|
-
extract_attributes(document) if document
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.parse(document, schema)
|
19
|
-
new(document: document, schema: schema).parse
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def extract_attributes(document)
|
25
|
-
document_with_klass = document_with_klass(document)
|
26
|
-
document_with_klass[:cls].parse(document_with_klass[:document], @schema)
|
27
|
-
end
|
28
|
-
|
29
|
-
def document_with_klass(document)
|
30
|
-
if !document.xpath("select").empty?
|
31
|
-
{ document: document.xpath("select"), cls: Express::TypeSelect }
|
32
|
-
|
33
|
-
elsif !document.xpath("enumeration").empty?
|
34
|
-
{ document: document.xpath("enumeration"), cls: Express::TypeEnum }
|
35
|
-
|
36
|
-
elsif !document.xpath("aggregate").empty?
|
37
|
-
{ document: document.xpath("aggregate"), cls: Express::TypeAggregate }
|
38
|
-
|
39
|
-
else
|
40
|
-
{ document: document, cls: Express::Type }
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,82 +0,0 @@
|
|
1
|
-
require "expressir/express/defined_type"
|
2
|
-
|
3
|
-
module Expressir
|
4
|
-
module Express
|
5
|
-
class TypeSelect < DefinedType
|
6
|
-
attr_accessor :selectitems_array, :selectitems, :extends, :extends_item,
|
7
|
-
:isExtensible, :selectitems_all, :isGenericEntity, :isBuiltin,
|
8
|
-
:cleaned_select_items
|
9
|
-
|
10
|
-
def initialize(options = {})
|
11
|
-
@isBuiltin = false
|
12
|
-
@isExtensible = false
|
13
|
-
@isGenericEntity = false
|
14
|
-
@selectitems = nil
|
15
|
-
@selectitems_array = []
|
16
|
-
@cleaned_select_items = nil
|
17
|
-
@wheres = []
|
18
|
-
@selectedBy = []
|
19
|
-
|
20
|
-
super(options)
|
21
|
-
end
|
22
|
-
|
23
|
-
##
|
24
|
-
# set cleaned_select_items = process select removing unnecessary
|
25
|
-
# entity types (i.e. if supertype is there)
|
26
|
-
#
|
27
|
-
def clean_select_items
|
28
|
-
@cleaned_select_items = ""
|
29
|
-
|
30
|
-
if selectitems != nil
|
31
|
-
itemname_list = selectitems.scan(/\w+/)
|
32
|
-
dupitem_list = []
|
33
|
-
for itemname in itemname_list
|
34
|
-
itemptr = schema.find_namedtype_by_name( itemname )
|
35
|
-
|
36
|
-
if itemptr.kind_of? EXPSM::Entity
|
37
|
-
|
38
|
-
for itemname2 in itemname_list
|
39
|
-
thetype = schema.find_namedtype_by_name( itemname2 )
|
40
|
-
|
41
|
-
if thetype != nil
|
42
|
-
if itemptr.supertypes_all != nil &&
|
43
|
-
itemptr.supertypes_all.include?(thetype.name)
|
44
|
-
|
45
|
-
dupitem_list.push itemname
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
itemname_list.each do |itemname|
|
53
|
-
if !dupitem_list.include? itemname
|
54
|
-
@cleaned_select_items = @cleaned_select_items + " " + itemname
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
@cleaned_select_items = @cleaned_select_items.lstrip
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
private
|
63
|
-
|
64
|
-
def extract_type_attributes(document)
|
65
|
-
if document.class == Nokogiri::XML::NodeSet
|
66
|
-
document = document.first
|
67
|
-
end
|
68
|
-
|
69
|
-
@selectitems = document.attributes["selectitems"]
|
70
|
-
@extends = document.attributes["basedon"]
|
71
|
-
@isExtensible = document.attributes["extensible"] == "YES"
|
72
|
-
@isGenericEntity = document.attributes["genericentity"] == "YES"
|
73
|
-
|
74
|
-
if isExtensible
|
75
|
-
@selectitems_all = selectitems
|
76
|
-
end
|
77
|
-
|
78
|
-
super(document)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require "expressir/express/model_element"
|
2
|
-
|
3
|
-
module Expressir
|
4
|
-
module Express
|
5
|
-
class UniqueRule < ModelElement
|
6
|
-
attr_accessor :name, :attributes
|
7
|
-
|
8
|
-
def initialize(options)
|
9
|
-
@name = nil
|
10
|
-
@attributes = []
|
11
|
-
@options = options
|
12
|
-
end
|
13
|
-
|
14
|
-
def parse
|
15
|
-
document = @options.fetch(:document, nil)
|
16
|
-
extract_unique_attributes(document)
|
17
|
-
|
18
|
-
self
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.parse(document)
|
22
|
-
new(document: document).parse
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def extract_unique_attributes(document)
|
28
|
-
@name = document.attributes["label"].to_s
|
29
|
-
@attributes = document.xpath("unique.attribute").map do |attribute|
|
30
|
-
attribute.attributes["attribute"]
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require "expressir/express/model_element"
|
2
|
-
|
3
|
-
module Expressir
|
4
|
-
module Express
|
5
|
-
class WhereRule < ModelElement
|
6
|
-
attr_accessor :name, :expression
|
7
|
-
|
8
|
-
def initialize(options = {})
|
9
|
-
@name = nil
|
10
|
-
@options = options
|
11
|
-
end
|
12
|
-
|
13
|
-
def parse
|
14
|
-
document = @options.fetch(:where, nil)
|
15
|
-
extract_where_attributes(document) if document
|
16
|
-
|
17
|
-
self
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.parse(document)
|
21
|
-
new(document: document).parse
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def extract_where_attributes(document)
|
27
|
-
@name = document.attributes["label"].to_s
|
28
|
-
@expression = document.attributes["expression"]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require "expressir/parser"
|
2
|
-
|
3
|
-
module Expressir
|
4
|
-
class ExpressParser
|
5
|
-
def initialize(file, options)
|
6
|
-
@file = file
|
7
|
-
@options = options
|
8
|
-
end
|
9
|
-
|
10
|
-
def to_owl
|
11
|
-
owl_parser.parse(express_xml, options)
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.to_owl(file, **options)
|
15
|
-
new(file, options).to_owl
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
attr_reader :file, :options
|
21
|
-
|
22
|
-
def owl_parser
|
23
|
-
Expressir::Parser::OwlParser
|
24
|
-
end
|
25
|
-
|
26
|
-
def express_xml
|
27
|
-
Expressir::Express.from_xml(file)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
data/lib/expressir/parser.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe "Expressir" do
|
4
|
-
describe "express-to-owl" do
|
5
|
-
pending "Still needs implementation"
|
6
|
-
|
7
|
-
it "convert express to owl system" do
|
8
|
-
command = %W(express-to-owl #{sample_file})
|
9
|
-
capture_stdout { Expressir::Cli.start(command) }
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def sample_file
|
14
|
-
@sample_file ||= Expressir.root_path.join(
|
15
|
-
"original", "examples", "ap233", "ap233e1_arm_lf_stepmod-2010-11-12.xml"
|
16
|
-
)
|
17
|
-
end
|
18
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe Expressir::Express::Repository do
|
4
|
-
describe ".from_file" do
|
5
|
-
it "build an instance from a file" do
|
6
|
-
name = "Ap233_systems_engineering_arm_LF"
|
7
|
-
|
8
|
-
repo = Expressir::Express::Repository.from_xml(sample_file)
|
9
|
-
schema = repo.schemas.first
|
10
|
-
|
11
|
-
expect(repo.name).to eq(name)
|
12
|
-
expect(repo.schemas.count).to eq(1)
|
13
|
-
expect(schema.name).to eq(name)
|
14
|
-
expect(schema.contents.count).to eq(795)
|
15
|
-
expect(schema.contents.first.schema).to eq(name)
|
16
|
-
expect(schema.contents.first.name).to eq("Abs_function")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def sample_file
|
21
|
-
@sample_file ||= Expressir.root_path.join(
|
22
|
-
"original", "examples", "ap233", "ap233e1_arm_lf_stepmod-2010-11-12.xml"
|
23
|
-
)
|
24
|
-
end
|
25
|
-
end
|
@@ -1,127 +0,0 @@
|
|
1
|
-
require "yaml"
|
2
|
-
require "spec_helper"
|
3
|
-
require "expressir/express_exp/parser"
|
4
|
-
require "expressir/express_exp/formatter"
|
5
|
-
require "expressir/express_exp/schema_head_formatter"
|
6
|
-
require "expressir/express_exp/hyperlink_formatter"
|
7
|
-
|
8
|
-
RSpec.describe Expressir::ExpressExp::Formatter do
|
9
|
-
describe ".format" do
|
10
|
-
it "exports an object (single.exp)" do
|
11
|
-
exp_file = Expressir.root_path.join("original", "examples", "syntax", "single.exp")
|
12
|
-
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "single_formatted.exp")
|
13
|
-
|
14
|
-
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
15
|
-
|
16
|
-
result = Expressir::ExpressExp::Formatter.format(repo)
|
17
|
-
# File.write(formatted_exp_file, result)
|
18
|
-
expected_result = File.read(formatted_exp_file)
|
19
|
-
|
20
|
-
expect(result).to eq(expected_result)
|
21
|
-
end
|
22
|
-
|
23
|
-
it "exports an object (multiple.exp)" do
|
24
|
-
exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
|
25
|
-
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple_formatted.exp")
|
26
|
-
|
27
|
-
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
28
|
-
|
29
|
-
result = Expressir::ExpressExp::Formatter.format(repo)
|
30
|
-
# File.write(formatted_exp_file, result)
|
31
|
-
expected_result = File.read(formatted_exp_file)
|
32
|
-
|
33
|
-
expect(result).to eq(expected_result)
|
34
|
-
end
|
35
|
-
|
36
|
-
it "exports an object (remark.exp)" do
|
37
|
-
exp_file = Expressir.root_path.join("original", "examples", "syntax", "remark.exp")
|
38
|
-
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "remark_formatted.exp")
|
39
|
-
|
40
|
-
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
41
|
-
|
42
|
-
result = Expressir::ExpressExp::Formatter.format(repo)
|
43
|
-
# File.write(formatted_exp_file, result)
|
44
|
-
expected_result = File.read(formatted_exp_file)
|
45
|
-
|
46
|
-
expect(result).to eq(expected_result)
|
47
|
-
end
|
48
|
-
|
49
|
-
it "exports an object (syntax.exp)" do
|
50
|
-
exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.exp")
|
51
|
-
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax_formatted.exp")
|
52
|
-
|
53
|
-
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
54
|
-
|
55
|
-
result = Expressir::ExpressExp::Formatter.format(repo)
|
56
|
-
# File.write(formatted_exp_file, result)
|
57
|
-
expected_result = File.read(formatted_exp_file)
|
58
|
-
|
59
|
-
expect(result).to eq(expected_result)
|
60
|
-
end
|
61
|
-
|
62
|
-
it "exports an object with schema head formatter (syntax.exp)" do
|
63
|
-
exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.exp")
|
64
|
-
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax_schema_head_formatted.exp")
|
65
|
-
|
66
|
-
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
67
|
-
|
68
|
-
formatter = Class.new(Expressir::ExpressExp::Formatter) do
|
69
|
-
include Expressir::ExpressExp::SchemaHeadFormatter
|
70
|
-
end
|
71
|
-
result = formatter.format(repo)
|
72
|
-
# File.write(formatted_exp_file, result)
|
73
|
-
expected_result = File.read(formatted_exp_file)
|
74
|
-
|
75
|
-
expect(result).to eq(expected_result)
|
76
|
-
end
|
77
|
-
|
78
|
-
it "exports an object with hyperlink formatter (syntax.exp)" do
|
79
|
-
exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.exp")
|
80
|
-
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax_hyperlink_formatted.exp")
|
81
|
-
|
82
|
-
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
83
|
-
|
84
|
-
formatter = Class.new(Expressir::ExpressExp::Formatter) do
|
85
|
-
include Expressir::ExpressExp::HyperlinkFormatter
|
86
|
-
end
|
87
|
-
result = formatter.format(repo)
|
88
|
-
# File.write(formatted_exp_file, result)
|
89
|
-
expected_result = File.read(formatted_exp_file)
|
90
|
-
|
91
|
-
expect(result).to eq(expected_result)
|
92
|
-
end
|
93
|
-
|
94
|
-
it "exports an object with hyperlink formatter (multiple.exp)" do
|
95
|
-
exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
|
96
|
-
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple_hyperlink_formatted.exp")
|
97
|
-
|
98
|
-
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
99
|
-
|
100
|
-
formatter = Class.new(Expressir::ExpressExp::Formatter) do
|
101
|
-
include Expressir::ExpressExp::HyperlinkFormatter
|
102
|
-
end
|
103
|
-
result = formatter.format(repo)
|
104
|
-
# File.write(formatted_exp_file, result)
|
105
|
-
expected_result = File.read(formatted_exp_file)
|
106
|
-
|
107
|
-
expect(result).to eq(expected_result)
|
108
|
-
end
|
109
|
-
|
110
|
-
it "exports an object with schema head and hyperlink formatter (multiple.exp)" do
|
111
|
-
exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
|
112
|
-
formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple_schema_head_hyperlink_formatted.exp")
|
113
|
-
|
114
|
-
repo = Expressir::ExpressExp::Parser.from_file(exp_file)
|
115
|
-
|
116
|
-
formatter = Class.new(Expressir::ExpressExp::Formatter) do
|
117
|
-
include Expressir::ExpressExp::SchemaHeadFormatter
|
118
|
-
include Expressir::ExpressExp::HyperlinkFormatter
|
119
|
-
end
|
120
|
-
result = formatter.format(repo)
|
121
|
-
# File.write(formatted_exp_file, result)
|
122
|
-
expected_result = File.read(formatted_exp_file)
|
123
|
-
|
124
|
-
expect(result).to eq(expected_result)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|