rgen 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +6 -1
  3. data/Rakefile +15 -25
  4. data/lib/rgen/fragment/fragmented_model.rb +2 -0
  5. data/lib/rgen/fragment/model_fragment.rb +3 -0
  6. data/lib/rgen/metamodel_builder/builder_extensions.rb +13 -5
  7. data/lib/rgen/metamodel_builder/builder_runtime.rb +12 -5
  8. data/test/array_extensions_test.rb +7 -7
  9. data/test/ea_instantiator_test.rb +2 -2
  10. data/test/ea_serializer_test.rb +2 -2
  11. data/test/ecore_self_test.rb +2 -2
  12. data/test/ecore_to_ruby_test.rb +2 -2
  13. data/test/environment_test.rb +2 -2
  14. data/test/json_test.rb +4 -4
  15. data/test/metamodel_builder_test.rb +69 -42
  16. data/test/metamodel_from_ecore_test.rb +1 -1
  17. data/test/metamodel_order_test.rb +2 -2
  18. data/test/metamodel_roundtrip_test.rb +2 -2
  19. data/test/method_delegation_test.rb +5 -5
  20. data/test/model_builder/builder_context_test.rb +3 -3
  21. data/test/model_builder/builder_test.rb +11 -11
  22. data/test/model_builder/reference_resolver_test.rb +3 -3
  23. data/test/model_builder/serializer_test.rb +2 -2
  24. data/test/model_fragment_test.rb +2 -2
  25. data/test/output_handler_test.rb +2 -2
  26. data/test/qualified_name_provider_test.rb +2 -2
  27. data/test/qualified_name_resolver_test.rb +4 -4
  28. data/test/reference_resolver_test.rb +4 -4
  29. data/test/rgen_test.rb +1 -1
  30. data/test/template_language_test.rb +6 -8
  31. data/test/testmodel/class_model_checker.rb +17 -17
  32. data/test/testmodel/ecore_model_checker.rb +13 -13
  33. data/test/testmodel/object_model_checker.rb +6 -6
  34. data/test/transformer_test.rb +3 -3
  35. data/test/util/file_cache_map_test.rb +2 -2
  36. data/test/util/pattern_matcher_test.rb +7 -7
  37. data/test/xml_instantiator_test/simple_ecore_model_checker.rb +12 -12
  38. data/test/xml_instantiator_test.rb +8 -8
  39. metadata +54 -23
  40. data/test/metamodel_roundtrip_test/TestModel_Regenerated.rb +0 -71
  41. data/test/metamodel_roundtrip_test/houseMetamodel_Regenerated.ecore +0 -162
  42. data/test/metamodel_roundtrip_test/using_builtin_types_serialized.ecore +0 -9
  43. data/test/model_builder/ecore_internal.rb +0 -113
  44. data/test/template_language_test/line_endings_mixed.txt +0 -2
  45. data/test/template_language_test/line_endings_unix.txt +0 -2
  46. data/test/template_language_test/line_endings_windows.txt +0 -2
  47. data/test/testmodel/ea_testmodel_regenerated.xml +0 -813
  48. data/test/util/file_cache_map_test/testdir/fileA +0 -1
@@ -37,7 +37,7 @@ class MetamodelFromEcoreTest < MetamodelBuilderTest
37
37
  mod = RGen::ECore::ECoreToRuby.new.create_module(package)
38
38
  obj = mod::Class1.new
39
39
  # the error is raised only when the feature is lazily constructed
40
- assert_raise StandardError do
40
+ assert_raises StandardError do
41
41
  obj.value
42
42
  end
43
43
  end
@@ -1,10 +1,10 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'rgen/ecore/ecore'
5
5
  require 'rgen/array_extensions'
6
6
 
7
- class MetamodelOrderTest < Test::Unit::TestCase
7
+ class MetamodelOrderTest < MiniTest::Test
8
8
  include RGen::ECore
9
9
 
10
10
  module TestMM1
@@ -1,13 +1,13 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'rgen/array_extensions'
5
5
  require 'rgen/util/model_comparator'
6
6
  require 'mmgen/metamodel_generator'
7
7
  require 'rgen/instantiator/ecore_xml_instantiator'
8
8
  require 'rgen/serializer/xmi20_serializer'
9
9
 
10
- class MetamodelRoundtripTest < Test::Unit::TestCase
10
+ class MetamodelRoundtripTest < MiniTest::Test
11
11
 
12
12
  TEST_DIR = File.dirname(__FILE__)+"/metamodel_roundtrip_test"
13
13
 
@@ -1,9 +1,9 @@
1
1
  $:.unshift File.dirname(__FILE__) + "/../lib"
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'rgen/util/method_delegation'
5
5
 
6
- class MethodDelegationTest < Test::Unit::TestCase
6
+ class MethodDelegationTest < MiniTest::Test
7
7
  include RGen
8
8
 
9
9
  class TestDelegate
@@ -88,7 +88,7 @@ class MethodDelegationTest < Test::Unit::TestCase
88
88
  assert_equal "AnotherConst::A::B::C", AnotherConst::A::B::C.to_s
89
89
 
90
90
  Util::MethodDelegation.unregisterDelegate(ConstPathElement, surroundingModule, "const_missing")
91
- assert_raise NameError do
91
+ assert_raises NameError do
92
92
  SomeArbitraryConst
93
93
  end
94
94
  end
@@ -123,7 +123,7 @@ class MethodDelegationTest < Test::Unit::TestCase
123
123
 
124
124
  delegate1.mode = :nothing
125
125
  # delegate1 just exits and thus returns nil
126
- assert_equal nil, delegator.send(method)
126
+ assert_nil delegator.send(method)
127
127
  assert_equal 2, delegate1.callcount
128
128
  # delegate2 is not called
129
129
  assert_equal 0, delegate2.callcount
@@ -167,7 +167,7 @@ class MethodDelegationTest < Test::Unit::TestCase
167
167
 
168
168
  def checkCallOriginal(delegator, method, originalResult, newMethod)
169
169
  if newMethod
170
- assert_raise NoMethodError do
170
+ assert_raises NoMethodError do
171
171
  result = delegator.send(method)
172
172
  end
173
173
  else
@@ -1,10 +1,10 @@
1
1
  $:.unshift File.dirname(__FILE__)+"/../lib"
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'rgen/ecore/ecore'
5
5
  require 'rgen/model_builder/builder_context'
6
6
 
7
- class BuilderContextTest < Test::Unit::TestCase
7
+ class BuilderContextTest < MiniTest::Test
8
8
 
9
9
  module BuilderExtension1
10
10
  module PackageA
@@ -50,7 +50,7 @@ class BuilderContextTest < Test::Unit::TestCase
50
50
  assert_equal 5, packBExt.inPackBExt
51
51
  assert_equal 7, packBExt.inBuilderContext
52
52
 
53
- assert_raise RuntimeError do
53
+ assert_raises RuntimeError do
54
54
  # aboveRoot is not contained within root
55
55
  assert_nil factory.moduleForPackage(aboveRoot)
56
56
  end
@@ -1,13 +1,13 @@
1
1
  $:.unshift File.dirname(__FILE__) + "/../lib"
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'rgen/ecore/ecore'
5
5
  require 'rgen/ecore/ecore_builder_methods'
6
6
  require 'rgen/environment'
7
7
  require 'rgen/model_builder'
8
8
  require 'model_builder/statemachine_metamodel'
9
9
 
10
- class ModelBuilderTest < Test::Unit::TestCase
10
+ class ModelBuilderTest < MiniTest::Test
11
11
 
12
12
  def test_statemachine
13
13
  result = RGen::ModelBuilder.build(StatemachineMetamodel) do
@@ -193,47 +193,47 @@ class ModelBuilderTest < Test::Unit::TestCase
193
193
 
194
194
  # TestClass1
195
195
  class1 = p1.eClassifiers.find{|c| c.name == "TestClass1"}
196
- assert_not_nil class1
196
+ assert class1 != nil
197
197
  assert class1.is_a?(RGen::ECore::EClass)
198
198
 
199
199
  # TestClass1.attr1
200
200
  attr1 = class1.eAllAttributes.find{|a| a.name == "attr1"}
201
- assert_not_nil attr1
201
+ assert attr1 != nil
202
202
  assert_equal RGen::ECore::EString, attr1.eType
203
203
 
204
204
  # TestClass1.attr2
205
205
  attr2 = class1.eAllAttributes.find{|a| a.name == "attr2"}
206
- assert_not_nil attr2
206
+ assert attr2 != nil
207
207
  assert_equal RGen::ECore::EInt, attr2.eType
208
208
 
209
209
  # TestClass2
210
210
  class2 = p1.eClassifiers.find{|c| c.name == "TestClass2"}
211
- assert_not_nil class2
211
+ assert class2 != nil
212
212
  assert class2.is_a?(RGen::ECore::EClass)
213
213
 
214
214
  # TestClass2.ref1
215
215
  ref1 = class2.eAllReferences.find{|a| a.name == "ref1"}
216
- assert_not_nil ref1
216
+ assert ref1 != nil
217
217
  assert_equal class1, ref1.eType
218
218
 
219
219
  # TestClass1.biRef1
220
220
  biRef1 = class1.eAllReferences.find{|r| r.name == "biRef1"}
221
- assert_not_nil biRef1
221
+ assert biRef1 != nil
222
222
  assert_equal class2, biRef1.eType
223
223
  biRef1Opp = class2.eAllReferences.find {|r| r.name == "testClass1"}
224
- assert_not_nil biRef1Opp
224
+ assert biRef1Opp != nil
225
225
  assert_equal class1, biRef1Opp.eType
226
226
  assert_equal biRef1Opp, biRef1.eOpposite
227
227
  assert_equal biRef1, biRef1Opp.eOpposite
228
228
 
229
229
  # TestClass1.testClass2
230
230
  tc2Ref = class1.eAllReferences.find{|r| r.name == "testClass2"}
231
- assert_not_nil tc2Ref
231
+ assert tc2Ref != nil
232
232
  assert_equal class2, tc2Ref.eType
233
233
  assert tc2Ref.containment
234
234
  assert_equal -1, tc2Ref.upperBound
235
235
  tc2RefOpp = class2.eAllReferences.find{|r| r.name == "tc1Parent"}
236
- assert_not_nil tc2RefOpp
236
+ assert tc2RefOpp != nil
237
237
  assert_equal class1, tc2RefOpp.eType
238
238
  assert !tc2RefOpp.containment
239
239
  assert_equal 1, tc2RefOpp.upperBound
@@ -1,10 +1,10 @@
1
1
  $:.unshift File.dirname(__FILE__)+"/../lib"
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'rgen/metamodel_builder'
5
5
  require 'rgen/model_builder/reference_resolver'
6
6
 
7
- class ReferenceResolverTest < Test::Unit::TestCase
7
+ class ReferenceResolverTest < MiniTest::Test
8
8
 
9
9
  class ClassA < RGen::MetamodelBuilder::MMBase
10
10
  has_attr "name"
@@ -122,7 +122,7 @@ class ReferenceResolverTest < Test::Unit::TestCase
122
122
  :reference => ClassC.ecore.eReferences.find{|r| r.name == "refCs"},
123
123
  :namespace => b1,
124
124
  :string => "b1.c5"))
125
- assert_raise RGen::ModelBuilder::ReferenceResolver::ResolverException do
125
+ assert_raises RGen::ModelBuilder::ReferenceResolver::ResolverException do
126
126
  resolver.resolve(toplevelNamespace)
127
127
  end
128
128
  end
@@ -1,6 +1,6 @@
1
1
  $:.unshift File.dirname(__FILE__) + "/../lib"
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'rgen/ecore/ecore'
5
5
 
6
6
  # The following would also influence other tests...
@@ -28,7 +28,7 @@ require 'rgen/instantiator/ecore_xml_instantiator'
28
28
  require 'rgen/model_builder'
29
29
  require 'model_builder/statemachine_metamodel'
30
30
 
31
- class ModelSerializerTest < Test::Unit::TestCase
31
+ class ModelSerializerTest < MiniTest::Test
32
32
  def test_ecore_internal
33
33
  File.open(File.dirname(__FILE__)+"/ecore_internal.rb","w") do |f|
34
34
  serializer = RGen::ModelBuilder::ModelSerializer.new(f, RGen::ECore.ecore)
@@ -1,10 +1,10 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'rgen/metamodel_builder'
5
5
  require 'rgen/fragment/model_fragment'
6
6
 
7
- class ModelFragmentTest < Test::Unit::TestCase
7
+ class ModelFragmentTest < MiniTest::Test
8
8
 
9
9
  module TestMetamodel
10
10
  extend RGen::MetamodelBuilder::ModuleExtension
@@ -1,9 +1,9 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'rgen/template_language/output_handler'
5
5
 
6
- class MetamodelBuilderTest < Test::Unit::TestCase
6
+ class MetamodelBuilderTest < MiniTest::Test
7
7
  def test_direct_nl
8
8
  h = RGen::TemplateLanguage::OutputHandler.new
9
9
  h.mode = :direct
@@ -1,10 +1,10 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'rgen/metamodel_builder'
5
5
  require 'rgen/serializer/qualified_name_provider'
6
6
 
7
- class QualifiedNameProviderTest < Test::Unit::TestCase
7
+ class QualifiedNameProviderTest < MiniTest::Test
8
8
 
9
9
  class AbstractTestNode < RGen::MetamodelBuilder::MMBase
10
10
  contains_many 'children', AbstractTestNode, "parent"
@@ -1,10 +1,10 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'rgen/metamodel_builder'
5
5
  require 'rgen/instantiator/qualified_name_resolver'
6
6
 
7
- class QualifiedNameResolverTest < Test::Unit::TestCase
7
+ class QualifiedNameResolverTest < MiniTest::Test
8
8
 
9
9
  class TestNode < RGen::MetamodelBuilder::MMBase
10
10
  has_attr 'name', String
@@ -86,8 +86,8 @@ class QualifiedNameResolverTest < Test::Unit::TestCase
86
86
  assert_equal model[1].children[0].children[0], res.resolveIdentifier("/Root2/Sub21/Sub211")
87
87
  # duplicate name yields two result elements
88
88
  assert_equal [model[2], model[3]], res.resolveIdentifier("/Root3")
89
- assert_equal nil, res.resolveIdentifier("/RootX")
90
- assert_equal nil, res.resolveIdentifier("/Root1/SubX")
89
+ assert_nil res.resolveIdentifier("/RootX")
90
+ assert_nil res.resolveIdentifier("/Root1/SubX")
91
91
  end
92
92
 
93
93
  def test_oneChild
@@ -1,10 +1,10 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'rgen/metamodel_builder'
5
5
  require 'rgen/instantiator/reference_resolver'
6
6
 
7
- class ReferenceResolverTest < Test::Unit::TestCase
7
+ class ReferenceResolverTest < MiniTest::Test
8
8
 
9
9
  class TestNode < RGen::MetamodelBuilder::MMBase
10
10
  has_attr 'name', String
@@ -107,9 +107,9 @@ class ReferenceResolverTest < Test::Unit::TestCase
107
107
  def check_model(nodeA, nodeB, nodeC)
108
108
  assert_equal nodeB, nodeA.other
109
109
  assert_equal [], nodeA.others
110
- assert_equal nil, nodeB.other
110
+ assert_nil nodeB.other
111
111
  assert_equal [nodeA, nodeC], nodeB.others
112
- assert_equal nil, nodeC.other
112
+ assert_nil nodeC.other
113
113
  assert_equal [], nodeC.others
114
114
  end
115
115
 
data/test/rgen_test.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  $:.unshift File.dirname(__FILE__)
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
 
5
5
  require 'array_extensions_test'
6
6
  require 'ea_instantiator_test'
@@ -1,10 +1,10 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'rgen/template_language'
5
5
  require 'rgen/metamodel_builder'
6
6
 
7
- class TemplateContainerTest < Test::Unit::TestCase
7
+ class TemplateContainerTest < MiniTest::Test
8
8
 
9
9
  TEMPLATES_DIR = File.dirname(__FILE__)+"/template_language_test/templates"
10
10
  OUTPUT_DIR = File.dirname(__FILE__)+"/template_language_test"
@@ -93,17 +93,15 @@ class TemplateContainerTest < Test::Unit::TestCase
93
93
  def test_null_context
94
94
  tc = RGen::TemplateLanguage::DirectoryTemplateContainer.new([MyMM, CCodeMM], OUTPUT_DIR)
95
95
  tc.load(TEMPLATES_DIR)
96
- assert_raise StandardError do
96
+ assert_raises StandardError do
97
97
  # the template must raise an exception because it calls expand :for => nil
98
98
  tc.expand('null_context_test::NullContextTestBad', :for => :dummy)
99
99
  end
100
- assert_raise StandardError do
100
+ assert_raises StandardError do
101
101
  # the template must raise an exception because it calls expand :foreach => nil
102
102
  tc.expand('null_context_test::NullContextTestBad2', :for => :dummy)
103
103
  end
104
- assert_nothing_raised do
105
- tc.expand('null_context_test::NullContextTestOk', :for => :dummy)
106
- end
104
+ tc.expand('null_context_test::NullContextTestOk', :for => :dummy)
107
105
  end
108
106
 
109
107
  def test_no_indent
@@ -141,7 +139,7 @@ class TemplateContainerTest < Test::Unit::TestCase
141
139
  tc = RGen::TemplateLanguage::DirectoryTemplateContainer.new([MyMM, CCodeMM], OUTPUT_DIR)
142
140
  tc.load(TEMPLATES_DIR)
143
141
  assert_equal "Local1\r\n", tc.expand('define_local_test/test::Test', :for => :dummy)
144
- assert_raise StandardError do
142
+ assert_raises StandardError do
145
143
  tc.expand('define_local_test/test::TestForbidden', :for => :dummy)
146
144
  end
147
145
  end
@@ -11,7 +11,7 @@ module ClassModelChecker
11
11
 
12
12
  # check main package
13
13
  mainPackage = envUML.find(:class => UML13::Package, :name => "HouseMetamodel").first
14
- assert_not_nil mainPackage
14
+ assert mainPackage != nil
15
15
 
16
16
  # check Rooms package
17
17
  subs = mainPackage.ownedElement.select{|e| e.is_a?(UML13::Package)}
@@ -26,10 +26,10 @@ module ClassModelChecker
26
26
  personClass = classes.find{|c| c.name == "Person"}
27
27
  meetingPlaceClass = classes.find{|c| c.name == "MeetingPlace"}
28
28
  cookingPlaceInterface = mainPackage.ownedElement.find{|e| e.is_a?(UML13::Interface) && e.name == "CookingPlace"}
29
- assert_not_nil houseClass
30
- assert_not_nil personClass
31
- assert_not_nil meetingPlaceClass
32
- assert_not_nil cookingPlaceInterface
29
+ assert houseClass != nil
30
+ assert personClass != nil
31
+ assert meetingPlaceClass != nil
32
+ assert cookingPlaceInterface != nil
33
33
 
34
34
  # check Rooms package classes
35
35
  classes = roomsPackage.ownedElement.select{|e| e.is_a?(UML13::Class)}
@@ -37,20 +37,20 @@ module ClassModelChecker
37
37
  roomClass = classes.find{|c| c.name == "Room"}
38
38
  kitchenClass = classes.find{|c| c.name == "Kitchen"}
39
39
  bathroomClass = classes.find{|c| c.name == "Bathroom"}
40
- assert_not_nil roomClass
41
- assert_not_nil kitchenClass
42
- assert_not_nil bathroomClass
40
+ assert roomClass != nil
41
+ assert kitchenClass != nil
42
+ assert bathroomClass != nil
43
43
 
44
44
  # check Room inheritance
45
45
  assert_equal 2, roomClass.specialization.child.size
46
- assert_not_nil roomClass.specialization.child.find{|c| c.name == "Kitchen"}
47
- assert_not_nil roomClass.specialization.child.find{|c| c.name == "Bathroom"}
46
+ assert nil != roomClass.specialization.child.find{|c| c.name == "Kitchen"}
47
+ assert nil != roomClass.specialization.child.find{|c| c.name == "Bathroom"}
48
48
  assert_equal 2, kitchenClass.generalization.parent.size
49
49
  assert_equal roomClass.object_id, kitchenClass.generalization.parent.find{|c| c.name == "Room"}.object_id
50
50
  assert_equal meetingPlaceClass.object_id, kitchenClass.generalization.parent.find{|c| c.name == "MeetingPlace"}.object_id
51
51
  assert_equal 1, bathroomClass.generalization.parent.size
52
52
  assert_equal roomClass.object_id, bathroomClass.generalization.parent.first.object_id
53
- assert_not_nil kitchenClass.clientDependency.find{|d| d.stereotype.name == "implements"}
53
+ assert nil != kitchenClass.clientDependency.find{|d| d.stereotype.name == "implements"}
54
54
  assert_equal cookingPlaceInterface.object_id, kitchenClass.clientDependency.supplier.find{|c| c.name == "CookingPlace"}.object_id
55
55
  assert_equal kitchenClass.object_id, cookingPlaceInterface.supplierDependency.client.find{|c| c.name == "Kitchen"}.object_id
56
56
 
@@ -72,8 +72,8 @@ module ClassModelChecker
72
72
  assert_equal 2, houseClass.remoteNavigableEnd.size
73
73
  bathEnd = houseClass.remoteNavigableEnd.find{|e| e.name == "bathroom"}
74
74
  kitchenEnd = houseClass.remoteNavigableEnd.find{|e| e.name== "kitchen"}
75
- assert_not_nil bathEnd
76
- assert_not_nil kitchenEnd
75
+ assert bathEnd != nil
76
+ assert kitchenEnd != nil
77
77
  assert_equal UML13::Association, bathEnd.association.class
78
78
  assert_equal UML13::Association, kitchenEnd.association.class
79
79
  assert_equal "1", kitchenEnd.multiplicity.range.first.lower
@@ -82,7 +82,7 @@ module ClassModelChecker
82
82
  # check House IN associations
83
83
  assert_equal 3, houseClass.localNavigableEnd.size
84
84
  homeEnd = houseClass.localNavigableEnd.find{|e| e.name == "home"}
85
- assert_not_nil homeEnd
85
+ assert homeEnd != nil
86
86
  assert_equal UML13::Association, homeEnd.association.class
87
87
  assert_equal "0", homeEnd.multiplicity.range.first.lower
88
88
  assert_equal "*", homeEnd.multiplicity.range.first.upper
@@ -97,14 +97,14 @@ module ClassModelChecker
97
97
  assert_nil mainPackage
98
98
 
99
99
  roomsPackage = envUML.find(:class => UML13::Package, :name => "Rooms").first
100
- assert_not_nil roomsPackage
100
+ assert roomsPackage != nil
101
101
 
102
102
  roomClass = envUML.find(:class => UML13::Class, :name => "Room").first
103
- assert_not_nil roomClass
103
+ assert roomClass != nil
104
104
 
105
105
  # House is created from an EAStub
106
106
  houseClass = roomClass.remoteCompositeEnd.first.type
107
- assert_not_nil houseClass
107
+ assert houseClass != nil
108
108
  assert_equal "House", houseClass.name
109
109
  # House is not in a package since it's just a stub
110
110
  assert houseClass.namespace.nil?
@@ -12,7 +12,7 @@ module ECoreModelChecker
12
12
 
13
13
  # check main package
14
14
  mainPackage = env.elements.select {|e| e.is_a? EPackage and e.name == "HouseMetamodel"}.first
15
- assert_not_nil mainPackage
15
+ assert mainPackage != nil
16
16
 
17
17
  # check Rooms package
18
18
  assert mainPackage.eSubpackages.is_a?(Array)
@@ -29,10 +29,10 @@ module ECoreModelChecker
29
29
  personClass = mainPackage.eClassifiers.select{|c| c.name == "Person"}.first
30
30
  meetingPlaceClass = mainPackage.eClassifiers.select{|c| c.name == "MeetingPlace"}.first
31
31
  cookingPlaceInterface = mainPackage.eClassifiers.select{|c| c.name == "CookingPlace"}.first
32
- assert_not_nil houseClass
33
- assert_not_nil personClass
34
- assert_not_nil meetingPlaceClass
35
- assert_not_nil cookingPlaceInterface
32
+ assert houseClass != nil
33
+ assert personClass != nil
34
+ assert meetingPlaceClass != nil
35
+ assert cookingPlaceInterface != nil
36
36
 
37
37
  # check Rooms package classes
38
38
  assert roomsPackage.eClassifiers.is_a?(Array)
@@ -41,9 +41,9 @@ module ECoreModelChecker
41
41
  roomClass = roomsPackage.eClassifiers.select{|c| c.name == "Room"}.first
42
42
  kitchenClass = roomsPackage.eClassifiers.select{|c| c.name == "Kitchen"}.first
43
43
  bathroomClass = roomsPackage.eClassifiers.select{|c| c.name == "Bathroom"}.first
44
- assert_not_nil roomClass
45
- assert_not_nil kitchenClass
46
- assert_not_nil bathroomClass
44
+ assert roomClass != nil
45
+ assert kitchenClass != nil
46
+ assert bathroomClass != nil
47
47
 
48
48
  # check Room inheritance
49
49
  assert kitchenClass.eSuperTypes.is_a?(Array)
@@ -63,7 +63,7 @@ module ECoreModelChecker
63
63
  assert_equal "room", roomRef.name
64
64
  assert_equal 1, roomRef.lowerBound
65
65
  assert_equal(-1, roomRef.upperBound)
66
- assert_not_nil roomRef.eOpposite
66
+ assert roomRef.eOpposite != nil
67
67
  assert_equal houseClass.object_id, roomRef.eOpposite.eType.object_id
68
68
 
69
69
  partOfRefs = roomClass.eReferences.select{|r| r.eOpposite && r.eOpposite.containment}
@@ -78,10 +78,10 @@ module ECoreModelChecker
78
78
  bathRef = houseClass.eReferences.find {|e| e.name == "bathroom"}
79
79
  kitchenRef = houseClass.eReferences.find {|e| e.name == "kitchen"}
80
80
  roomRef = houseClass.eReferences.find {|e| e.name == "room"}
81
- assert_not_nil bathRef
81
+ assert bathRef != nil
82
82
  assert_nil bathRef.eOpposite
83
- assert_not_nil kitchenRef
84
- assert_not_nil roomRef
83
+ assert kitchenRef != nil
84
+ assert roomRef != nil
85
85
  assert_equal 1, kitchenRef.lowerBound
86
86
  assert_equal 1, kitchenRef.upperBound
87
87
  assert_equal 1, roomRef.lowerBound
@@ -91,7 +91,7 @@ module ECoreModelChecker
91
91
  houseInRefs = env.find(:class => EReference, :eType => houseClass)
92
92
  assert_equal 3, houseInRefs.size
93
93
  homeEnd = houseInRefs.find{|e| e.name == "home"}
94
- assert_not_nil homeEnd
94
+ assert homeEnd != nil
95
95
  assert_equal 0, homeEnd.lowerBound
96
96
  assert_equal(-1, homeEnd.upperBound)
97
97
 
@@ -18,10 +18,10 @@ module ObjectModelChecker
18
18
 
19
19
  # check main package
20
20
  mainPackage = envUML.find(:class => UML13::Package, :name => "HouseExampleModel").first
21
- assert_not_nil mainPackage
21
+ assert mainPackage != nil
22
22
 
23
23
  eaRootCollaboration = mainPackage.ownedElement.find{|e| e.is_a?(UML13::Collaboration) && e.name == "Collaborations"}
24
- assert_not_nil eaRootCollaboration
24
+ assert eaRootCollaboration != nil
25
25
 
26
26
  # check main package objects
27
27
  objects = eaRootCollaboration.ownedElement.select{|e| e.is_a?(UML13::ClassifierRole)}
@@ -56,10 +56,10 @@ module ObjectModelChecker
56
56
  assert someonesHouse.localCompositeEnd.otherEnd.is_a?(Array)
57
57
  assert_equal 4, someonesHouse.localCompositeEnd.otherEnd.size
58
58
  assert someonesHouse.localCompositeEnd.otherEnd.all?{|e| e.name == "room"}
59
- assert_not_nil someonesHouse.localCompositeEnd.otherEnd.getType.find{|o| o == yellowRoom}
60
- assert_not_nil someonesHouse.localCompositeEnd.otherEnd.getType.find{|o| o == greenRoom}
61
- assert_not_nil someonesHouse.localCompositeEnd.otherEnd.getType.find{|o| o == hotRoom}
62
- assert_not_nil someonesHouse.localCompositeEnd.otherEnd.getType.find{|o| o == wetRoom}
59
+ assert nil != someonesHouse.localCompositeEnd.otherEnd.getType.find{|o| o == yellowRoom}
60
+ assert nil != someonesHouse.localCompositeEnd.otherEnd.getType.find{|o| o == greenRoom}
61
+ assert nil != someonesHouse.localCompositeEnd.otherEnd.getType.find{|o| o == hotRoom}
62
+ assert nil != someonesHouse.localCompositeEnd.otherEnd.getType.find{|o| o == wetRoom}
63
63
 
64
64
  end
65
65
  end
@@ -1,14 +1,14 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
2
  $:.unshift File.join(File.dirname(__FILE__),"..","test")
3
3
 
4
- require 'test/unit'
4
+ require 'minitest/autorun'
5
5
  require 'rgen/transformer'
6
6
  require 'rgen/environment'
7
7
  require 'rgen/util/model_comparator'
8
8
  require 'metamodels/uml13_metamodel'
9
9
  require 'testmodel/class_model_checker'
10
10
 
11
- class TransformerTest < Test::Unit::TestCase
11
+ class TransformerTest < MiniTest::Test
12
12
 
13
13
  class ModelIn
14
14
  attr_accessor :name
@@ -135,7 +135,7 @@ class TransformerTest < Test::Unit::TestCase
135
135
  assert_equal t1.trans(from).object_id, t2.trans(from).object_id
136
136
  assert_equal :dummy, t2.trans(from2)
137
137
  # and no transformer rule is evaluated at this point
138
- assert_equal nil, t2.modelInTrans_count
138
+ assert_nil t2.modelInTrans_count
139
139
  # now transform a new object in second transformer
140
140
  assert t2.trans(from3).is_a?(ModelOut)
141
141
  assert_equal "Test3", t2.trans(from3).name
@@ -1,10 +1,10 @@
1
1
  $:.unshift(File.dirname(__FILE__)+"/../../lib")
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'fileutils'
5
5
  require 'rgen/util/file_cache_map'
6
6
 
7
- class FileCacheMapTest < Test::Unit::TestCase
7
+ class FileCacheMapTest < MiniTest::Test
8
8
 
9
9
  TestDir = File.dirname(__FILE__)+"/file_cache_map_test/testdir"
10
10
 
@@ -1,12 +1,12 @@
1
1
  $:.unshift(File.dirname(__FILE__)+"/../../lib")
2
2
 
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'rgen/environment'
5
5
  require 'rgen/metamodel_builder'
6
6
  require 'rgen/model_builder'
7
7
  require 'rgen/util/pattern_matcher'
8
8
 
9
- class PatternMatcherTest < Test::Unit::TestCase
9
+ class PatternMatcherTest < MiniTest::Test
10
10
 
11
11
  module TestMM
12
12
  extend RGen::MetamodelBuilder::ModuleExtension
@@ -51,7 +51,7 @@ def test_simple
51
51
  env = modelA
52
52
 
53
53
  match = matcher.find_pattern(env, "simple")
54
- assert_not_nil match
54
+ assert match != nil
55
55
  assert_equal "A", match.root.name
56
56
  assert_equal env.find(:class => TestMM::Node, :name => "A").first.object_id, match.root.object_id
57
57
  assert_equal 2, match.elements.size
@@ -75,21 +75,21 @@ def test_value_binding
75
75
  env = modelA
76
76
 
77
77
  match = matcher.find_pattern(env, "single_child")
78
- assert_not_nil match
78
+ assert match != nil
79
79
  assert_equal "A", match.root.name
80
80
  assert_equal "AA", match.bound_values[1].name
81
81
 
82
82
  match = matcher.find_pattern(env, "single_child", "D")
83
- assert_not_nil match
83
+ assert match != nil
84
84
  assert_equal "D", match.root.name
85
85
  assert_equal "DD", match.bound_values[0].name
86
86
 
87
87
  match = matcher.find_pattern(env, "double_child")
88
- assert_not_nil match
88
+ assert match != nil
89
89
  assert_equal "C", match.root.name
90
90
 
91
91
  match = matcher.find_pattern(env, "child_pattern")
92
- assert_not_nil match
92
+ assert match != nil
93
93
  assert_equal ["AA"], match.bound_values
94
94
  end
95
95