mercurial/HGTests.st
author vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
Fri, 09 Nov 2012 12:09:13 +0000
changeset 38 c3d02ed6a645
parent 36 41cb88196e69
child 39 10e693b3e034
permissions -rw-r--r--
- HGWorkingCopyFile changed: #status - HGCommandParser changed: #nextLine #nextSpace - HGTests changed: #test_01a - HGStatus added: #theOnlyInstance - HGCommand class definition added: #initialize changed: #execute

"{ 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 |

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

    "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'.

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

!HGTests class methodsFor:'documentation'!

version_SVN
    ^ '$Id::                                                                                                                        $'
! !