Tests fixed. Not-yet-supported tests marked as skipped.
"{ Package: 'stx:libscm/mercurial' }"
TestCase subclass:#HGCommandParserTests
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'SCM-Mercurial-Tests'
!
!HGCommandParserTests methodsFor:'tests - commands'!
test_cmd_status_01
| statuses |
statuses := (HGCommandParser on: 'M HGRevisionInfo.st
? something.txt
') parseCommandStatus.
self assert: statuses size == 2.
self assert: statuses first first isModified.
self assert: statuses first second = 'HGRevisionInfo.st'.
self assert: statuses second first isUntracked.
self assert: statuses second second = 'something.txt'.
"Created: / 21-11-2012 / 00:53:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
test_cmd_status_02
| statuses |
statuses := (HGCommandParser on: 'A HGRevisionInfo.st
HGVersionInfo.st
') parseCommandStatus.
self assert: statuses size == 1.
self assert: statuses first first isCopied.
self assert: statuses first first source = 'HGVersionInfo.st'.
self assert: statuses first second = 'HGRevisionInfo.st'.
"Created: / 21-11-2012 / 01:08:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
test_cmd_status_03
| statuses |
statuses := (HGCommandParser on: 'A HGRevisionInfo.st
HGVersionInfo.st
? something.txt
') parseCommandStatus.
self assert: statuses size == 2.
self assert: statuses first first isCopied.
self assert: statuses first first source = 'HGVersionInfo.st'.
self assert: statuses first second = 'HGRevisionInfo.st'.
self assert: statuses second first isUntracked.
self assert: statuses second second = 'something.txt'.
"Created: / 21-11-2012 / 01:09:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGCommandParserTests methodsFor:'tests - misc'!
test_misc_01
| id |
id := (HGCommandParser on: '4:6f88e1f44d9eb86e0b56ca15e30e5d786acd83c7') parseNodeId.
self assert: ( id revno == 4 ).
self assert: ( id hexPrintString = '6F88E1F44D9EB86E0B56CA15E30E5D786ACD83C7' ).
id := (HGCommandParser on: '4:6f88e1f44d9e') parseNodeId.
self assert: ( id revno == 4 ).
self assert: ( id hexPrintString = '6F88E1F44D9E' ).
id := (HGCommandParser on: '-1:0000000000000000000000000000000000000000') parseNodeId.
self assert: id == HGNodeId null.
id := (HGCommandParser on: '-1:000000000000') parseNodeId.
self assert: id == HGNodeId null.
"/ Too short id
self
should:[id := (HGCommandParser on: '4:6f88e1f44d9eb86e0b56ca15e30e5d786acd83') parseNodeId.]
raise: Error.
self
should:[id := (HGCommandParser on: '4:6f88e1f44d9') parseNodeId.]
raise: Error.
"/ Invalid char
self
should:[id := (HGCommandParser on: '4:6f88e1f44d9eb86e0b56ca15e30e5d786acd8X') parseNodeId.]
raise: Error.
self
should:[id := (HGCommandParser on: '4:6f88e1f44d9X') parseNodeId.]
raise: Error.
"Created: / 13-11-2012 / 16:34:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
test_misc_03
| rev |
rev := (HGCommandParser on: '4:6f88e1f44d9eb86e0b56ca15e30e5d786acd83c7
default
3:912a64597e4f133ffbc1fdabdda99167a2d69ce2 -1:0000000000000000000000000000000000000000
Jan Vrany <jan.vrany@fit.cvut.cz>
2012-10-17 13:20 +0200
Commit 4
**EOE**
') parseLogEntry.
self assert: rev id revno = 4.
self assert: rev author = 'Jan Vrany <jan.vrany@fit.cvut.cz>'.
self assert: rev timestamp hour = 13.
self assert: rev message = 'Commit 4'
"Created: / 13-11-2012 / 17:16:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 21-11-2012 / 18:07:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
test_misc_03b
| rev |
rev := (HGCommandParser on: '4:6f88e1f44d9eb86e0b56ca15e30e5d786acd83c7
default
3:912a64597e4f133ffbc1fdabdda99167a2d69ce2 -1:0000000000000000000000000000000000000000
Jan Vrany <jan.vrany@fit.cvut.cz>
2012-10-17 13:20 +0200
Commit 4
Two lones
**EOE**
') parseLogEntry.
self assert: rev message = 'Commit 4
Two lones'
"Created: / 21-11-2012 / 18:09:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
test_misc_04
| revs |
revs := (HGCommandParser on: '4:6f88e1f44d9eb86e0b56ca15e30e5d786acd83c7
default
3:912a64597e4f133ffbc1fdabdda99167a2d69ce2 -1:0000000000000000000000000000000000000000
Jan Vrany <jan.vrany@fit.cvut.cz>
2012-10-17 13:20 +0200
Commit 4
**EOE**
3:912a64597e4f133ffbc1fdabdda99167a2d69ce2
default
2:db43a5baa9acaf2536d8b12c070b4f5e0363d45c -1:0000000000000000000000000000000000000000
Jan Vrany <jan.vrany@fit.cvut.cz>
2012-10-17 13:20 +0200
Commit 3
**EOE**
') parseLog.
self assert: revs size == 2
"Created: / 13-11-2012 / 17:31:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
test_version_2_3_3
| vsn |
vsn := (HGCommandParser on: 'Mercurial Distributed SCM (version 2.3.2)
(see http://mercurial.selenic.com for more information)
Copyright (C) 2005-2012 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
') parseCommandVersion.
self assert: vsn = #(2 3 2)
"Created: / 19-11-2012 / 20:59:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
test_version_2_4
| vsn |
vsn := (HGCommandParser on: 'Mercurial Distributed SCM (version 2.4)
(see http://mercurial.selenic.com for more information)
Copyright (C) 2005-2012 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
') parseCommandVersion.
self assert: vsn = #(2 4 nil)
"Created: / 19-11-2012 / 21:00:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGCommandParserTests class methodsFor:'documentation'!
version_HG
"Never, ever change this method. Ask JV or CG why"
^thisContext method mclass theNonMetaclass instVarNamed: #revision
!
version_SVN
^ '§Id:: §'
! !