Skip to content

Commit

Permalink
Add Aunt/Uncle test for --ignored-entities parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Kim Dung-Pham committed Sep 25, 2018
1 parent b10ff4a commit 00aa081
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ run_or_die 'xcodebuild -project ../mogenerator.xcodeproj -scheme mogenerator cle
run_or_die 'xcodebuild -project ../mogenerator.xcodeproj -scheme mogenerator'

def gen_and_compile_objc(mogenPath, extra_mogen_args, extra_llvm_args)
puts "*** Testing Objective-C"
status = '*** Testing Objective-C'
status << ' with parameters' if extra_mogen_args.length > 0
puts status
ENV['MOMC_NO_INVERSE_RELATIONSHIP_WARNINGS'] = '1'
run_or_die "#{mogenPath.gsub(/ /, '\\ ')} --model test.xcdatamodel --output MOs --baseClass MyBaseClass #{extra_mogen_args}"
run_or_die 'cp ./objc/Gender.* ./objc/MyBaseClass.* MOs'
Expand Down Expand Up @@ -60,6 +62,16 @@ task :swift do
Rake::Task[:clean].execute
end

desc 'Generate, Compile and Run with parameters'
task :objc do
Rake::Task[:clean].execute
gen_and_compile_objc(MOGENERATOR_PATH, '--ignored-entities Uncle,Aunt', '')
includes_uncle = Dir.entries('./MOs').any? do |file|
file.include?('Uncle') || file.include?('Aunt')
end
raise 'Failed: Ignored entities should not be generated' if includes_uncle
Rake::Task[:clean].execute
end

desc 'Clean output'
task :clean do
Expand Down
4 changes: 4 additions & 0 deletions test/test.xcdatamodel/contents
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
<relationship name="children" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="Child" indexed="YES" syncable="YES"/>
<relationship name="orderedChildren" optional="YES" toMany="YES" deletionRule="Cascade" ordered="YES" destinationEntity="Child" inverseName="parent" inverseEntity="Child" indexed="YES" syncable="YES"/>
</entity>
<entity name="Uncle" representedClassName="UncleMO" parentEntity="Human" syncable="YES">
<attribute name="attribute" optional="YES" attributeType="String" syncable="YES"/>
</entity>
<fetchRequest name="allHumans" entity="Human"/>
<fetchRequest name="byHumanName" entity="Human" predicateString="humanName == $humanName"/>
<fetchRequest name="byParent" entity="Child" predicateString="parent == $parent"/>
Expand All @@ -69,5 +72,6 @@
<element name="EntityWithBaseClass" positionX="342" positionY="18" width="128" height="60"/>
<element name="Human" positionX="169" positionY="18" width="128" height="105"/>
<element name="Parent" positionX="34" positionY="114" width="128" height="270"/>
<element name="Uncle" positionX="243" positionY="-36" width="128" height="60"/>
</elements>
</model>

0 comments on commit 00aa081

Please sign in to comment.