mercurial/HGTests.st
author vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
Wed, 14 Nov 2012 01:15:30 +0000
changeset 46 d5a192b11a1a
parent 40 e3699c0b00f9
child 49 ffb879bfafe7
permissions -rw-r--r--
- More Smalltalk/X support

"{ Package: 'stx:libscm/mercurial' }"

TestCase subclass:#HGTests
	instanceVariableNames:'repositories'
	classVariableNames:''
	poolDictionaries:''
	category:'SCM-Mercurial-Core-Tests'
!


!HGTests class methodsFor:'accessing'!

resources
    ^Array with: HGRepositoriesResource

    "Created: / 19-09-2012 / 18:55:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 17-10-2012 / 13:01:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!HGTests methodsFor:'accessing'!

repositoryNamed: nm
    | dir |

    dir := HGRepositoriesResource current directoryForRepositoryNamed: nm.
    repositories add:  dir.
    ^HGRepository on: dir.

    "Created: / 19-09-2012 / 19:04:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 17-10-2012 / 13:28:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!HGTests methodsFor:'private'!

performTest

    GitCommitterQuery answer: (GitSignature name: self class name email: (self class name , '@nowhere')) do:[
        super performTest
    ].

    "Created: / 30-09-2012 / 10:02:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!HGTests methodsFor:'running'!

setUp

    repositories := OrderedCollection new.

    "Created: / 19-09-2012 / 19:01:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

tearDown

    repositories do:[:e|
        [
            e asFilename recursiveRemove
        ] on: Error do:[
            "Stupid windows"
        ]
    ].

    "Created: / 19-09-2012 / 19:03:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 30-09-2012 / 05:26:48 / jv"
! !

!HGTests methodsFor:'tests - basic workflow'!

test_01a

    "Test modification of working copy and commit back"

    | repo wc f1_txt oldcs currentcs |

    repo := self repositoryNamed: 'test_repo_01'.
    "
    UserPreferences fileBrowserClass openOn: repo directory.    
    "
    wc := repo workingCopy.
    oldcs := wc changeset.

    self assert: oldcs id revno == 4.

    "Modify some file"
    f1_txt := wc / 'f1.txt'.
    self assert: f1_txt isModified not.

    f1_txt writingFileDo:[:s|
        s nextPutAll: 'modified from test_01a'.
    ].
    self assert: f1_txt isModified.

    wc commit: 'test_01a commit 1'.
    currentcs := wc changeset.

    self assert: f1_txt isModified not.
    self assert: currentcs id revno == 5.
    self assert: currentcs parent1 = oldcs.

    "Created: / 19-09-2012 / 23:06:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 13-11-2012 / 21:48:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!HGTests class methodsFor:'documentation'!

version_SVN
    ^ '$Id::                                                                                                                        $'
! !