RegressionTests__ProjectDefinitionTests.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 05 Apr 2016 19:13:28 +0100
branchjv
changeset 1485 5a1aadddbc7f
parent 1087 b76941bb0907
child 1499 26a16a04219b
permissions -rw-r--r--
Merge

"{ Encoding: utf8 }"

"{ Package: 'exept:regression' }"

"{ NameSpace: RegressionTests }"

TestCase subclass:#ProjectDefinitionTests
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'tests-Regression'
!


!ProjectDefinitionTests methodsFor:'running'!

tearDown
    | classes methods |

    "Also, wipe out all mocks"
    classes := OrderedCollection new.
    methods := OrderedCollection new.
    Smalltalk allClassesDo:[:cls|
        (cls package notNil and:[cls package startsWith:'exept:regression/testData']) ifTrue:[
            classes add: cls
        ] ifFalse:[
            cls methodsDo:[:m|(m package notNil and:[m package startsWith:'exept:regression/testData']) ifTrue:[methods add: m]].
            cls class methodsDo:[:m|(m package notNil and:[m package startsWith:'exept:regression/testData']) ifTrue:[methods add: m]].
        ]
    ].
    Class withoutUpdatingChangesDo:[
        classes do:[:cls|Smalltalk removeClass: cls].
        methods do:[:m|m mclass removeSelector: m selector]
    ].

    "Created: / 22-03-2013 / 11:31:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ProjectDefinitionTests methodsFor:'tests - utf8'!

test_filein_01
    "
    Test of filein of a class with non-ASCII/ISO8859-1 chars
    "
    | file |

    file := (Smalltalk getPackageDirectoryForPackage: self class package) / 'testData' / 'packages' / 'p1utf8' / 'ProjectDefinitionTestsP1UTF8Bar.st'.
    self assert: file exists.

    file fileIn.

    self assert: (Smalltalk at:#ProjectDefinitionTestsP1UTF8Bar) notNil.
    self assert: (Smalltalk at:#ProjectDefinitionTestsP1UTF8Bar) new zork size = 38.
    self assert: (Smalltalk at:#ProjectDefinitionTestsP1UTF8Bar) new zork = 'Příliš žluťoučký kůň úpěl ďábelské ódy'.

    "Created: / 22-03-2013 / 11:39:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

test_filein_01b
    "
    Test of filein of a class with non-ASCII/ISO8859-1 chars
    "
    | file |

    file := (Smalltalk getPackageDirectoryForPackage: self class package) / 'testData' / 'packages' / 'p1utf8' / 'ProjectDefinitionTestsP1UTF8Bar.st'.
    self assert: file exists.

    file contents asString readStream fileIn.

    self assert: (Smalltalk at:#ProjectDefinitionTestsP1UTF8Bar) notNil.
    self assert: (Smalltalk at:#ProjectDefinitionTestsP1UTF8Bar) new zork size = 38.
    self assert: (Smalltalk at:#ProjectDefinitionTestsP1UTF8Bar) new zork = 'Příliš žluťoučký kůň úpěl ďábelské ódy'.

    "Created: / 25-03-2013 / 22:51:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

test_filein_03
    "
    Test of filein of a extension with non-ASCII/ISO8859-1 chars
    "
    | file |

    file := (Smalltalk getPackageDirectoryForPackage: self class package) / 'testData' / 'packages' / 'p1utf8' / 'extensions.st'.
    self assert: file exists.

    file fileIn.

    self assert: nil zork size = 38.
    self assert: nil zork = 'Příliš žluťoučký kůň úpěl ďábelské ódy'.

    "Created: / 22-03-2013 / 11:40:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

test_loadPackage_utf8_01
    "
    Test of filein of a extension with non-ASCII/ISO8859-1 chars
    "

    Transcript showCR:'loading p1utf8 package...'.
    [
        Smalltalk loadPackage: 'exept:regression/testData/packages/p1utf8'.
    ] ifCurtailed:[
        thisContext fullPrintAll
    ].    
    Transcript showCR:'done.'.

    self assert: (Smalltalk at:#ProjectDefinitionTestsP1UTF8Bar) notNil.
    self assert: (Smalltalk at:#ProjectDefinitionTestsP1UTF8Bar) new zork size = 38.
    self assert: (Smalltalk at:#ProjectDefinitionTestsP1UTF8Bar) new zork = 'Příliš žluťoučký kůň úpěl ďábelské ódy'.

    self assert: nil zork size = 38.
    self assert: nil zork = 'Příliš žluťoučký kůň úpěl ďábelské ódy'.

    Transcript showCR:'test done.'.
    Smalltalk unloadPackage: 'exept:regression/testData/packages/p1utf8'.

    "Created: / 22-03-2013 / 11:44:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ProjectDefinitionTests methodsFor:'tests-obsolete'!

test1
    self skipIf:true description:'obsolete and outdated'.

    DAPASX::DapasXProject compileClassNames.
    self assert:(DAPASX::DapasXProject classNames asSortedCollection = DAPASX::DapasXProject searchForClassesNamesWithProject asSortedCollection)

    "Modified: / 09-08-2006 / 18:22:16 / fm"
! !

!ProjectDefinitionTests class methodsFor:'documentation'!

version
    ^ '$Header$'
!

version_CVS
    ^ '$Header$'
! !