expressir 0.2.27-x86-linux → 1.0.0-x86-linux
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.so +0 -0
- data/lib/expressir/{express_exp → express}/2.5/express_parser.so +0 -0
- data/lib/expressir/{express_exp → express}/2.6/express_parser.so +0 -0
- data/lib/expressir/{express_exp → express}/2.7/express_parser.so +0 -0
- data/lib/expressir/{express_exp → express}/3.0/express_parser.so +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
@@ -4,8 +4,8 @@ begin
|
|
4
4
|
rescue LoadError
|
5
5
|
require_relative "express_parser"
|
6
6
|
end
|
7
|
-
require 'expressir/
|
8
|
-
require 'expressir/
|
7
|
+
require 'expressir/express/visitor'
|
8
|
+
require 'expressir/express/resolve_references_model_visitor'
|
9
9
|
|
10
10
|
=begin
|
11
11
|
char_stream = Antlr4::Runtime::CharStreams.from_string(input, 'String')
|
@@ -23,7 +23,7 @@ repo = visitor.visit(parse_tree)
|
|
23
23
|
=end
|
24
24
|
|
25
25
|
module Expressir
|
26
|
-
module
|
26
|
+
module Express
|
27
27
|
class Parser
|
28
28
|
def self.from_file(file, options = {})
|
29
29
|
skip_references = options[:skip_references]
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require "expressir/
|
1
|
+
require "expressir/express/model_visitor"
|
2
2
|
require "expressir/model"
|
3
3
|
|
4
4
|
module Expressir
|
5
|
-
module
|
5
|
+
module Express
|
6
6
|
class ResolveReferencesModelVisitor < ModelVisitor
|
7
7
|
def visit(node)
|
8
8
|
if node.is_a? Model::Expressions::SimpleReference
|
@@ -32,7 +32,7 @@ require "set"
|
|
32
32
|
# - e.g. see visit_schema_decl
|
33
33
|
|
34
34
|
module Expressir
|
35
|
-
module
|
35
|
+
module Express
|
36
36
|
class Visitor < ::ExpressParser::Visitor
|
37
37
|
REMARK_CHANNEL = 2
|
38
38
|
|
@@ -694,7 +694,7 @@ module Expressir
|
|
694
694
|
id = visit_if(ctx__rule_label_id)
|
695
695
|
expression = visit_if(ctx__expression)
|
696
696
|
|
697
|
-
Model::
|
697
|
+
Model::WhereRule.new({
|
698
698
|
id: id,
|
699
699
|
expression: expression
|
700
700
|
})
|
@@ -759,8 +759,8 @@ module Expressir
|
|
759
759
|
*visit_if(ctx__entity_body__derive_clause),
|
760
760
|
*visit_if(ctx__entity_body__inverse_clause)
|
761
761
|
]
|
762
|
-
|
763
|
-
|
762
|
+
unique_rules = visit_if(ctx__entity_body__unique_clause, [])
|
763
|
+
where_rules = visit_if(ctx__entity_body__where_clause, [])
|
764
764
|
|
765
765
|
Model::Entity.new({
|
766
766
|
id: id,
|
@@ -768,8 +768,8 @@ module Expressir
|
|
768
768
|
supertype_expression: supertype_expression,
|
769
769
|
subtype_of: subtype_of,
|
770
770
|
attributes: attributes,
|
771
|
-
|
772
|
-
|
771
|
+
unique_rules: unique_rules,
|
772
|
+
where_rules: where_rules
|
773
773
|
})
|
774
774
|
end
|
775
775
|
|
@@ -834,15 +834,13 @@ module Expressir
|
|
834
834
|
ctx__enumeration_extension__enumeration_items = ctx__enumeration_extension&.enumeration_items
|
835
835
|
|
836
836
|
extensible = ctx__EXTENSIBLE && true
|
837
|
-
|
838
|
-
|
839
|
-
extension_items = visit_if(ctx__enumeration_extension__enumeration_items, [])
|
837
|
+
based_on = visit_if(ctx__enumeration_extension__type_ref)
|
838
|
+
items = visit_if(ctx__enumeration_items || ctx__enumeration_extension__enumeration_items, [])
|
840
839
|
|
841
840
|
Model::Types::Enumeration.new({
|
842
841
|
extensible: extensible,
|
843
|
-
|
844
|
-
|
845
|
-
extension_items: extension_items
|
842
|
+
based_on: based_on,
|
843
|
+
items: items
|
846
844
|
})
|
847
845
|
end
|
848
846
|
|
@@ -1870,7 +1868,7 @@ module Expressir
|
|
1870
1868
|
constants = visit_if(ctx__algorithm_head__constant_decl, [])
|
1871
1869
|
variables = visit_if(ctx__algorithm_head__local_decl, [])
|
1872
1870
|
statements = visit_if_map(ctx__stmt)
|
1873
|
-
|
1871
|
+
where_rules = visit_if(ctx__where_clause, [])
|
1874
1872
|
|
1875
1873
|
Model::Rule.new({
|
1876
1874
|
id: id,
|
@@ -1883,7 +1881,7 @@ module Expressir
|
|
1883
1881
|
constants: constants,
|
1884
1882
|
variables: variables,
|
1885
1883
|
statements: statements,
|
1886
|
-
|
1884
|
+
where_rules: where_rules
|
1887
1885
|
})
|
1888
1886
|
end
|
1889
1887
|
|
@@ -2012,16 +2010,14 @@ module Expressir
|
|
2012
2010
|
|
2013
2011
|
extensible = ctx__EXTENSIBLE && true
|
2014
2012
|
generic_entity = ctx__GENERIC_ENTITY && true
|
2015
|
-
|
2016
|
-
|
2017
|
-
extension_items = visit_if(ctx__select_extension__select_list, [])
|
2013
|
+
based_on = visit_if(ctx__select_extension__type_ref)
|
2014
|
+
items = visit_if(ctx__select_list || ctx__select_extension__select_list, [])
|
2018
2015
|
|
2019
2016
|
Model::Types::Select.new({
|
2020
2017
|
extensible: extensible,
|
2021
2018
|
generic_entity: generic_entity,
|
2022
|
-
|
2023
|
-
|
2024
|
-
extension_items: extension_items
|
2019
|
+
based_on: based_on,
|
2020
|
+
items: items
|
2025
2021
|
})
|
2026
2022
|
end
|
2027
2023
|
|
@@ -2315,13 +2311,13 @@ module Expressir
|
|
2315
2311
|
ctx__where_clause = ctx.where_clause
|
2316
2312
|
|
2317
2313
|
id = visit_if(ctx__type_id)
|
2318
|
-
|
2319
|
-
|
2314
|
+
underlying_type = visit_if(ctx__underlying_type)
|
2315
|
+
where_rules = visit_if(ctx__where_clause, [])
|
2320
2316
|
|
2321
2317
|
Model::Type.new({
|
2322
2318
|
id: id,
|
2323
|
-
|
2324
|
-
|
2319
|
+
underlying_type: underlying_type,
|
2320
|
+
where_rules: where_rules
|
2325
2321
|
})
|
2326
2322
|
end
|
2327
2323
|
|
@@ -2381,7 +2377,7 @@ module Expressir
|
|
2381
2377
|
id = visit_if(ctx__rule_label_id)
|
2382
2378
|
attributes = visit_if_map(ctx__referenced_attribute)
|
2383
2379
|
|
2384
|
-
Model::
|
2380
|
+
Model::UniqueRule.new({
|
2385
2381
|
id: id,
|
2386
2382
|
attributes: attributes
|
2387
2383
|
})
|
data/lib/expressir/model.rb
CHANGED
@@ -22,9 +22,9 @@ require 'expressir/model/schema_version'
|
|
22
22
|
require 'expressir/model/schema_version_item'
|
23
23
|
require 'expressir/model/subtype_constraint'
|
24
24
|
require 'expressir/model/type'
|
25
|
-
require 'expressir/model/
|
25
|
+
require 'expressir/model/unique_rule'
|
26
26
|
require 'expressir/model/variable'
|
27
|
-
require 'expressir/model/
|
27
|
+
require 'expressir/model/where_rule'
|
28
28
|
require 'expressir/model/expressions/aggregate_initializer'
|
29
29
|
require 'expressir/model/expressions/aggregate_item'
|
30
30
|
require 'expressir/model/expressions/binary_expression'
|
@@ -7,8 +7,8 @@ module Expressir
|
|
7
7
|
model_attr_accessor :supertype_expression
|
8
8
|
model_attr_accessor :subtype_of
|
9
9
|
model_attr_accessor :attributes
|
10
|
-
model_attr_accessor :
|
11
|
-
model_attr_accessor :
|
10
|
+
model_attr_accessor :unique_rules
|
11
|
+
model_attr_accessor :where_rules
|
12
12
|
model_attr_accessor :informal_propositions
|
13
13
|
|
14
14
|
def initialize(options = {})
|
@@ -21,8 +21,8 @@ module Expressir
|
|
21
21
|
@supertype_expression = options[:supertype_expression]
|
22
22
|
@subtype_of = options[:subtype_of] || []
|
23
23
|
@attributes = options[:attributes] || []
|
24
|
-
@
|
25
|
-
@
|
24
|
+
@unique_rules = options[:unique_rules] || []
|
25
|
+
@where_rules = options[:where_rules] || []
|
26
26
|
@informal_propositions = options[:informal_propositions] || []
|
27
27
|
|
28
28
|
super
|
@@ -31,8 +31,8 @@ module Expressir
|
|
31
31
|
def children
|
32
32
|
[
|
33
33
|
*attributes,
|
34
|
-
*
|
35
|
-
*
|
34
|
+
*unique_rules,
|
35
|
+
*where_rules,
|
36
36
|
*informal_propositions,
|
37
37
|
*remark_items
|
38
38
|
]
|
@@ -96,7 +96,7 @@ module Expressir
|
|
96
96
|
def to_hash(options = {})
|
97
97
|
root_path = options[:root_path]
|
98
98
|
formatter = options[:formatter]
|
99
|
-
include_empty = options[:include_empty]
|
99
|
+
include_empty = options[:include_empty]
|
100
100
|
|
101
101
|
hash = {}
|
102
102
|
hash[CLASS_KEY] = self.class.name
|
data/lib/expressir/model/rule.rb
CHANGED
@@ -12,7 +12,7 @@ module Expressir
|
|
12
12
|
model_attr_accessor :constants
|
13
13
|
model_attr_accessor :variables
|
14
14
|
model_attr_accessor :statements
|
15
|
-
model_attr_accessor :
|
15
|
+
model_attr_accessor :where_rules
|
16
16
|
model_attr_accessor :informal_propositions
|
17
17
|
|
18
18
|
def initialize(options = {})
|
@@ -30,7 +30,7 @@ module Expressir
|
|
30
30
|
@constants = options[:constants] || []
|
31
31
|
@variables = options[:variables] || []
|
32
32
|
@statements = options[:statements] || []
|
33
|
-
@
|
33
|
+
@where_rules = options[:where_rules] || []
|
34
34
|
@informal_propositions = options[:informal_propositions] || []
|
35
35
|
|
36
36
|
super
|
@@ -50,7 +50,7 @@ module Expressir
|
|
50
50
|
*procedures,
|
51
51
|
*constants,
|
52
52
|
*variables,
|
53
|
-
*
|
53
|
+
*where_rules,
|
54
54
|
*informal_propositions,
|
55
55
|
*remark_items
|
56
56
|
]
|
data/lib/expressir/model/type.rb
CHANGED
@@ -3,8 +3,8 @@ module Expressir
|
|
3
3
|
class Type < ModelElement
|
4
4
|
include Identifier
|
5
5
|
|
6
|
-
model_attr_accessor :
|
7
|
-
model_attr_accessor :
|
6
|
+
model_attr_accessor :underlying_type
|
7
|
+
model_attr_accessor :where_rules
|
8
8
|
model_attr_accessor :informal_propositions
|
9
9
|
|
10
10
|
def initialize(options = {})
|
@@ -13,21 +13,21 @@ module Expressir
|
|
13
13
|
@remark_items = options[:remark_items] || []
|
14
14
|
@source = options[:source]
|
15
15
|
|
16
|
-
@
|
17
|
-
@
|
16
|
+
@underlying_type = options[:underlying_type]
|
17
|
+
@where_rules = options[:where_rules] || []
|
18
18
|
@informal_propositions = options[:informal_propositions] || []
|
19
19
|
|
20
20
|
super
|
21
21
|
end
|
22
22
|
|
23
23
|
def enumeration_items
|
24
|
-
|
24
|
+
underlying_type.is_a?(Types::Enumeration) ? underlying_type.items : []
|
25
25
|
end
|
26
26
|
|
27
27
|
def children
|
28
28
|
[
|
29
29
|
*enumeration_items,
|
30
|
-
*
|
30
|
+
*where_rules,
|
31
31
|
*informal_propositions,
|
32
32
|
*remark_items
|
33
33
|
]
|
@@ -3,15 +3,13 @@ module Expressir
|
|
3
3
|
module Types
|
4
4
|
class Enumeration < ModelElement
|
5
5
|
model_attr_accessor :extensible
|
6
|
+
model_attr_accessor :based_on
|
6
7
|
model_attr_accessor :items
|
7
|
-
model_attr_accessor :extension_type
|
8
|
-
model_attr_accessor :extension_items
|
9
8
|
|
10
9
|
def initialize(options = {})
|
11
10
|
@extensible = options[:extensible]
|
11
|
+
@based_on = options[:based_on]
|
12
12
|
@items = options[:items] || []
|
13
|
-
@extension_type = options[:extension_type]
|
14
|
-
@extension_items = options[:extension_items] || []
|
15
13
|
|
16
14
|
super
|
17
15
|
end
|
@@ -4,16 +4,14 @@ module Expressir
|
|
4
4
|
class Select < ModelElement
|
5
5
|
model_attr_accessor :extensible
|
6
6
|
model_attr_accessor :generic_entity
|
7
|
+
model_attr_accessor :based_on
|
7
8
|
model_attr_accessor :items
|
8
|
-
model_attr_accessor :extension_type
|
9
|
-
model_attr_accessor :extension_items
|
10
9
|
|
11
10
|
def initialize(options = {})
|
12
11
|
@extensible = options[:extensible]
|
13
12
|
@generic_entity = options[:generic_entity]
|
13
|
+
@based_on = options[:based_on]
|
14
14
|
@items = options[:items] || []
|
15
|
-
@extension_type = options[:extension_type]
|
16
|
-
@extension_items = options[:extension_items] || []
|
17
15
|
|
18
16
|
super
|
19
17
|
end
|
data/lib/expressir/version.rb
CHANGED
data/rakelib/cross-ruby.rake
CHANGED
@@ -296,7 +296,7 @@ require "rake/extensiontask"
|
|
296
296
|
|
297
297
|
Rake::ExtensionTask.new("express_parser", GEMSPEC) do |ext|
|
298
298
|
ext.ext_dir = "ext/express-parser"
|
299
|
-
ext.lib_dir = File.join(*['lib', 'expressir', '
|
299
|
+
ext.lib_dir = File.join(*['lib', 'expressir', 'express', ENV['FAT_DIR']].compact)
|
300
300
|
ext.config_options << ENV['EXTOPTS']
|
301
301
|
ext.cross_compile = true
|
302
302
|
ext.cross_platform = CROSS_RUBIES.map(&:platform).uniq
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require "yaml"
|
2
2
|
require "tempfile"
|
3
3
|
require "spec_helper"
|
4
|
-
require "expressir/
|
5
|
-
require "expressir/
|
4
|
+
require "expressir/express/parser"
|
5
|
+
require "expressir/express/cache"
|
6
6
|
|
7
|
-
RSpec.describe Expressir::
|
7
|
+
RSpec.describe Expressir::Express::Cache do
|
8
8
|
TEST_VERSION = "0.0.0"
|
9
9
|
|
10
10
|
describe ".to_file" do
|
@@ -14,7 +14,7 @@ RSpec.describe Expressir::ExpressExp::Cache do
|
|
14
14
|
repository = Expressir::Model::Repository.new
|
15
15
|
|
16
16
|
begin
|
17
|
-
Expressir::
|
17
|
+
Expressir::Express::Cache.to_file(temp_file, repository, test_overwrite_version: TEST_VERSION)
|
18
18
|
|
19
19
|
size = File.size(temp_file)
|
20
20
|
|
@@ -33,9 +33,9 @@ RSpec.describe Expressir::ExpressExp::Cache do
|
|
33
33
|
repository = Expressir::Model::Repository.new
|
34
34
|
|
35
35
|
begin
|
36
|
-
Expressir::
|
36
|
+
Expressir::Express::Cache.to_file(temp_file, repository, test_overwrite_version: TEST_VERSION)
|
37
37
|
|
38
|
-
result = Expressir::
|
38
|
+
result = Expressir::Express::Cache.from_file(temp_file, test_overwrite_version: TEST_VERSION)
|
39
39
|
|
40
40
|
expect(result).to be_instance_of(Expressir::Model::Repository)
|
41
41
|
ensure
|
@@ -50,11 +50,11 @@ RSpec.describe Expressir::ExpressExp::Cache do
|
|
50
50
|
repository = Expressir::Model::Repository.new
|
51
51
|
|
52
52
|
begin
|
53
|
-
Expressir::
|
53
|
+
Expressir::Express::Cache.to_file(temp_file, repository, test_overwrite_version: TEST_VERSION)
|
54
54
|
|
55
55
|
expect do
|
56
|
-
Expressir::
|
57
|
-
end.to raise_error(Expressir::
|
56
|
+
Expressir::Express::Cache.from_file(temp_file)
|
57
|
+
end.to raise_error(Expressir::Error)
|
58
58
|
ensure
|
59
59
|
temp_file.close
|
60
60
|
temp_file.unlink
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require "yaml"
|
2
|
+
require "spec_helper"
|
3
|
+
require "expressir/express/parser"
|
4
|
+
require "expressir/express/formatter"
|
5
|
+
require "expressir/express/schema_head_formatter"
|
6
|
+
require "expressir/express/hyperlink_formatter"
|
7
|
+
|
8
|
+
RSpec.describe Expressir::Express::Formatter do
|
9
|
+
describe ".format" do
|
10
|
+
it "exports an object (single.exp)" do
|
11
|
+
exp_file = Expressir.root_path.join("spec", "syntax", "single.exp")
|
12
|
+
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "single_formatted.exp")
|
13
|
+
|
14
|
+
repo = Expressir::Express::Parser.from_file(exp_file)
|
15
|
+
|
16
|
+
result = Expressir::Express::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("spec", "syntax", "multiple.exp")
|
25
|
+
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "multiple_formatted.exp")
|
26
|
+
|
27
|
+
repo = Expressir::Express::Parser.from_file(exp_file)
|
28
|
+
|
29
|
+
result = Expressir::Express::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("spec", "syntax", "remark.exp")
|
38
|
+
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "remark_formatted.exp")
|
39
|
+
|
40
|
+
repo = Expressir::Express::Parser.from_file(exp_file)
|
41
|
+
|
42
|
+
result = Expressir::Express::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("spec", "syntax", "syntax.exp")
|
51
|
+
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "syntax_formatted.exp")
|
52
|
+
|
53
|
+
repo = Expressir::Express::Parser.from_file(exp_file)
|
54
|
+
|
55
|
+
result = Expressir::Express::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("spec", "syntax", "syntax.exp")
|
64
|
+
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "syntax_schema_head_formatted.exp")
|
65
|
+
|
66
|
+
repo = Expressir::Express::Parser.from_file(exp_file)
|
67
|
+
|
68
|
+
formatter = Class.new(Expressir::Express::Formatter) do
|
69
|
+
include Expressir::Express::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("spec", "syntax", "syntax.exp")
|
80
|
+
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "syntax_hyperlink_formatted.exp")
|
81
|
+
|
82
|
+
repo = Expressir::Express::Parser.from_file(exp_file)
|
83
|
+
|
84
|
+
formatter = Class.new(Expressir::Express::Formatter) do
|
85
|
+
include Expressir::Express::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("spec", "syntax", "multiple.exp")
|
96
|
+
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "multiple_hyperlink_formatted.exp")
|
97
|
+
|
98
|
+
repo = Expressir::Express::Parser.from_file(exp_file)
|
99
|
+
|
100
|
+
formatter = Class.new(Expressir::Express::Formatter) do
|
101
|
+
include Expressir::Express::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("spec", "syntax", "multiple.exp")
|
112
|
+
formatted_exp_file = Expressir.root_path.join("spec", "syntax", "multiple_schema_head_hyperlink_formatted.exp")
|
113
|
+
|
114
|
+
repo = Expressir::Express::Parser.from_file(exp_file)
|
115
|
+
|
116
|
+
formatter = Class.new(Expressir::Express::Formatter) do
|
117
|
+
include Expressir::Express::SchemaHeadFormatter
|
118
|
+
include Expressir::Express::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
|