test/MCVersionTest.st
author Claus Gittinger <cg@exept.de>
Tue, 08 May 2018 19:54:33 +0200
changeset 1042 3b8c88c55251
parent 818 54a20a94c9be
child 1121 c5661215109c
permissions -rw-r--r--
#FEATURE by cg class: MCRepositoryGroup changed: #initializeRepositoriesFromUserSettings
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"{ Package: 'stx:goodies/monticello/test' }"
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
MCTestCase subclass:#MCVersionTest
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
	instanceVariableNames:'version'
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
	classVariableNames:''
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	poolDictionaries:''
818
54a20a94c9be Tests moved to category SCM-Monticello-Tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
     7
	category:'SCM-Monticello-Tests'
23
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
!
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
!MCVersionTest methodsFor:'asserting'!
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
assert: aSelector orders: sexpr as: array
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
	| expected |
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	expected := OrderedCollection new.
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	version := self versionFromTree: sexpr.
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	version perform: aSelector with: [:ea | expected add: ea info name].
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	self assert: expected asArray = array
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
assert: aSelector orders: sexpr as: expected unresolved: unresolved
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	| missing visited |
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
	visited := OrderedCollection new.
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
	missing := OrderedCollection new.
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
	version := self versionFromTree: sexpr.
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
	version 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
		perform: aSelector 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
		with: [:ea | visited add: ea info name]
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
		with: [:ea | missing add: ea name].
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
	self assert: visited asArray = expected.
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
	self assert: missing asArray = unresolved.
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
! !
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
!MCVersionTest methodsFor:'building'!
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
dependencyFromTree: sexpr
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
	^ MCMockDependency fromTree: sexpr
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
!
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
versionFromTree: sexpr
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
	^ (self dependencyFromTree: sexpr) resolve
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
! !
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
!MCVersionTest methodsFor:'tests'!
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
testAllAvailablePostOrder
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
	self 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
		assert: #allAvailableDependenciesDo: 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
		orders: #(a ((b (d e)) c)) 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
		as: #(d e b c)
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
!
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
testAllMissing
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
	self 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
		assert: #allDependenciesDo: 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
		orders: #(a ((b (d e)) (c missing))) 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
		as: #(d e b)
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
!
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
testAllUnresolved
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
	self 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
		assert: #allDependenciesDo:ifUnresolved: 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
		orders: #(a ((b (d e)) (c missing)))
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
		as: #(d e b)
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
		unresolved: #(c)
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
!
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
testDependencyOrder
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
	self 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
		assert: #allDependenciesDo: 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
		orders: #(a (b c)) 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
		as: #(b c)
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
!
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
testPostOrder
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
	self 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
		assert: #allDependenciesDo: 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
		orders: #(a ((b (d e)) c)) 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
		as: #(d e b c)
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
!
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
testWithAll
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
	self 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
		assert: #withAllDependenciesDo: 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
		orders: #(a ((b (d e)) c)) 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
		as: #(d e b c a)
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
!
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
testWithAllMissing
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
	self 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
		assert: #withAllDependenciesDo: 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
		orders: #(a ((b (d e)) (c missing))) 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
		as: #(d e b a)
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
!
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
testWithAllUnresolved
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
	self 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
		assert: #withAllDependenciesDo:ifUnresolved: 
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
		orders: #(a ((b (d e)) (c missing)))
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
		as: #(d e b a)
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
		unresolved: #(c)
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
! !
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
!MCVersionTest class methodsFor:'documentation'!
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
version
818
54a20a94c9be Tests moved to category SCM-Monticello-Tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
   107
    ^ '$Header: /cvs/stx/stx/goodies/monticello/test/MCVersionTest.st,v 1.2 2013-05-29 00:01:51 vrany Exp $'
23
5062bbab297f initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
! !
818
54a20a94c9be Tests moved to category SCM-Monticello-Tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
   109