mercurial/HGStXTests.st
changeset 411 858944cebec4
parent 397 579b4fd3e9a9
child 415 02e914a86b76
--- a/mercurial/HGStXTests.st	Sat Mar 08 10:29:38 2014 +0000
+++ b/mercurial/HGStXTests.st	Fri Mar 14 22:59:53 2014 +0000
@@ -2858,6 +2858,185 @@
     self assert: p7n3n2rev isVirtual not.
 
     "Created: / 08-03-2014 / 10:11:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_packagerev_changeset_01
+    | repo p6rev p6cs |
+
+    repo := self repositoryNamed: 'mocks/hg/p6'.
+    p6rev := (repo @ 1) rootPackage.
+    p6cs  := p6rev changeSet.
+
+    self assert: p6cs size == 21.
+
+    "01"self assert: (p6cs contains:[:c | c isClassDefinitionChange and:[ c className = 'MocksHGP6Bar' ] ] ).
+    "02"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Bar' and:[ c selector == #bar ] ] ]).
+    "03"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Bar' and:[ c selector == #name ] ] ]).
+    "04"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Bar class' and:[ c selector == #version_HG ] ] ]).
+
+    "05"self assert: (p6cs contains:[:c | c isClassDefinitionChange and:[ c className = 'MocksHGP6Foo' ] ] ).
+    "06"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Foo' and:[ c selector == #foo1 ] ] ]).
+    "07"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Foo' and:[ c selector == #foo2 ] ] ]).
+    "08"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Foo' and:[ c selector == #foo3 ] ] ]).
+    "09"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Foo class' and:[ c selector == #version_HG ] ] ]).
+
+    "10"self assert: (p6cs contains:[:c | c isClassDefinitionChange and:[ c className = 'mocks_hg_p6' ] ] ).
+    "11"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #excludedFromPreRequisites ] ] ]).
+    "12"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #mandatoryPreRequisites ] ] ]).
+    "13"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #referencedPreRequisites ] ] ]).
+    "14"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #subProjects ] ] ]).
+    "15"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #classNamesAndAttributes ] ] ]).
+    "16"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #extensionMethodNames ] ] ]).
+    "17"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #description ] ] ]).
+    "18"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #legalCopyright ] ] ]).
+    "19"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #productName ] ] ]).
+    "20"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #version_HG ] ] ]).
+    "21"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #companyName ] ] ]).
+
+    "Created: / 13-03-2014 / 22:35:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-03-2014 / 21:04:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_packagerev_changeset_02
+    | repo p6rev p6cs |
+
+    repo := self repositoryNamed: 'mocks/hg/p6'.
+    p6rev := (repo @ 5) rootPackage.
+    p6cs  := p6rev changeSet.
+
+    self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'Object' and:[ c selector == #greet ] ] ]).
+
+    "Created: / 14-03-2014 / 21:19:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_packagerev_changeset_03
+    | repo p6hgcs p6rev p6cs |
+
+    repo := self repositoryNamed: 'mocks/hg/p6'.
+    p6hgcs := repo @ 1.
+    "/ Simulate missing abbrev.stc...  
+    p6hgcs root children removeKey: 'abbrev.stc'.
+
+    p6rev := p6hgcs rootPackage.
+    p6cs  := p6rev changeSet.
+
+    self assert: p6cs size == 21.
+
+    "01"self assert: (p6cs contains:[:c | c isClassDefinitionChange and:[ c className = 'MocksHGP6Bar' ] ] ).
+    "02"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Bar' and:[ c selector == #bar ] ] ]).
+    "03"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Bar' and:[ c selector == #name ] ] ]).
+    "04"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Bar class' and:[ c selector == #version_HG ] ] ]).
+
+    "05"self assert: (p6cs contains:[:c | c isClassDefinitionChange and:[ c className = 'MocksHGP6Foo' ] ] ).
+    "06"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Foo' and:[ c selector == #foo1 ] ] ]).
+    "07"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Foo' and:[ c selector == #foo2 ] ] ]).
+    "08"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Foo' and:[ c selector == #foo3 ] ] ]).
+    "09"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Foo class' and:[ c selector == #version_HG ] ] ]).
+
+    "10"self assert: (p6cs contains:[:c | c isClassDefinitionChange and:[ c className = 'mocks_hg_p6' ] ] ).
+    "11"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #excludedFromPreRequisites ] ] ]).
+    "12"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #mandatoryPreRequisites ] ] ]).
+    "13"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #referencedPreRequisites ] ] ]).
+    "14"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #subProjects ] ] ]).
+    "15"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #classNamesAndAttributes ] ] ]).
+    "16"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #extensionMethodNames ] ] ]).
+    "17"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #description ] ] ]).
+    "18"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #legalCopyright ] ] ]).
+    "19"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #productName ] ] ]).
+    "20"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #version_HG ] ] ]).
+    "21"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #companyName ] ] ]).
+
+    "Created: / 14-03-2014 / 21:46:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_packagerev_changeset_04
+    | repo p6hgcs p6rev p6cs warnings |
+
+    repo := self repositoryNamed: 'mocks/hg/p6'.
+    p6hgcs := repo @ 1.
+    "/ Simulate missing class (listed in classNamesAndAttributes)
+    p6hgcs root children removeKey: 'MocksHGP6Bar.st'.
+
+    p6rev := p6hgcs rootPackage.
+    warnings := OrderedCollection new.
+    [
+        p6cs := p6rev changeSet.
+    ] on: SCMWarning do:[:ex |
+        warnings add: ex.
+        ex proceed.
+    ].
+
+    self assert: p6cs size == 17.
+    self assert: warnings size == 1.
+
+    "05"self assert: (p6cs contains:[:c | c isClassDefinitionChange and:[ c className = 'MocksHGP6Foo' ] ] ).
+    "06"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Foo' and:[ c selector == #foo1 ] ] ]).
+    "07"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Foo' and:[ c selector == #foo2 ] ] ]).
+    "08"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Foo' and:[ c selector == #foo3 ] ] ]).
+    "09"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'MocksHGP6Foo class' and:[ c selector == #version_HG ] ] ]).
+
+    "10"self assert: (p6cs contains:[:c | c isClassDefinitionChange and:[ c className = 'mocks_hg_p6' ] ] ).
+    "11"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #excludedFromPreRequisites ] ] ]).
+    "12"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #mandatoryPreRequisites ] ] ]).
+    "13"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #referencedPreRequisites ] ] ]).
+    "14"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #subProjects ] ] ]).
+    "15"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #classNamesAndAttributes ] ] ]).
+    "16"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #extensionMethodNames ] ] ]).
+    "17"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #description ] ] ]).
+    "18"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #legalCopyright ] ] ]).
+    "19"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #productName ] ] ]).
+    "20"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #version_HG ] ] ]).
+    "21"self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'mocks_hg_p6 class' and:[ c selector == #companyName ] ] ]).
+
+    "Created: / 14-03-2014 / 22:39:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_packagerev_changeset_05
+    | repo p6hgcs p6rev p6cs warnings |
+
+    repo := self repositoryNamed: 'mocks/hg/p6'.
+    p6hgcs := repo @ 5.
+    "/ Simulate missing extensions.st
+    p6hgcs root children removeKey: 'extensions.st'.
+
+    p6rev := p6hgcs rootPackage.
+    warnings := OrderedCollection new.
+    [
+        p6cs := p6rev changeSet.
+    ] on: SCMWarning do:[:ex |
+        warnings add: ex.
+        ex proceed.
+    ].
+
+    self assert: warnings size == 1.
+
+    self deny: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'Object' and:[ c selector == #greet ] ] ]).
+
+    "Created: / 14-03-2014 / 22:51:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_packagerev_changeset_06
+    | repo p6hgcs p6rev p6cs warnings |
+
+    repo := self repositoryNamed: 'mocks/hg/p6'.
+    p6hgcs := repo @ 5.
+    "/ Simulate empty extensionMethodNames but non-empty extensions.st
+    p6hgcs rootPackage definition extensionMethodNames: nil.  
+
+    p6rev := p6hgcs rootPackage.
+    warnings := OrderedCollection new.
+    [
+        p6cs := p6rev changeSet.
+    ] on: SCMWarning do:[:ex |
+        warnings add: ex.
+        ex proceed.
+    ].
+
+    self assert: warnings size == 1.
+
+    self assert: (p6cs contains:[:c | c isMethodCodeChange and:[ c className = 'Object' and:[ c selector == #greet ] ] ]).
+
+    "Created: / 14-03-2014 / 22:53:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !HGStXTests methodsFor:'utilities'!