# HG changeset patch # User Jan Vrany # Date 1309285992 -7200 # Node ID aec603e794ba80bba6a5e74f32c939e7e540c121 # Parent 649bd275c083f356ac5ca7d84280001ab7576410 initial checkin diff -r 649bd275c083 -r aec603e794ba SelectorNamespacesTests.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SelectorNamespacesTests.st Tue Jun 28 20:33:12 2011 +0200 @@ -0,0 +1,169 @@ +" + COPYRIGHT (c) 2006 by eXept Software AG + All Rights Reserved + + This software is furnished under a license and may be used + only in accordance with the terms of that license and with the + inclusion of the above copyright notice. This software may not + be provided or otherwise made available to, or used by, any + other person. No title to or ownership of the software is + hereby transferred. +" +"{ Package: 'exept:regression' }" + +"{ NameSpace: RegressionTests }" + +TestCase subclass:#SelectorNamespacesTests + instanceVariableNames:'ambiguousMessageSelector' + classVariableNames:'' + poolDictionaries:'' + category:'Kernel-Tests' +! + +!SelectorNamespacesTests class methodsFor:'documentation'! + +copyright +" + COPYRIGHT (c) 2006 by eXept Software AG + All Rights Reserved + + This software is furnished under a license and may be used + only in accordance with the terms of that license and with the + inclusion of the above copyright notice. This software may not + be provided or otherwise made available to, or used by, any + other person. No title to or ownership of the software is + hereby transferred. +" +! ! + +!SelectorNamespacesTests methodsFor:'error handling'! + +ambiguousMessage: aMessage + + ambiguousMessageSelector := aMessage selector + + "Created: / 19-08-2010 / 22:29:51 / Jan Vrany " +! ! + +!SelectorNamespacesTests methodsFor:'initialization & release'! + +setUp + + (NameSpace name: #TestNS3) import: (NameSpace name: #TestNS2). + + (NameSpace name: #TestNS4) import: (NameSpace name: #TestNS1). + (NameSpace name: #TestNS4) import: (NameSpace name: #TestNS2). + + ObjectMemory flushCaches + + "Modified: / 21-07-2010 / 17:12:01 / Jan Vrany " +! + +tearDown + + (NameSpace name: #TestNS1) setImports: nil. + (NameSpace name: #TestNS2) setImports: nil. + (NameSpace name: #TestNS3) setImports: nil. + (NameSpace name: #TestNS4) setImports: nil. + + "Created: / 21-07-2010 / 16:02:13 / Jan Vrany " +! ! + +!SelectorNamespacesTests methodsFor:'methods'! + +bar + + + + ^self foo + + "Created: / 21-07-2010 / 15:59:15 / Jan Vrany " +! + +foo + + + ^#foo_NS1 + + "Created: / 01-07-2010 / 18:09:55 / Jan Vrany " + "Modified: / 21-07-2010 / 15:45:27 / Jan Vrany " +! + +foo + + + ^#foo_NS2 + + "Created: / 21-07-2010 / 15:47:40 / Jan Vrany " +! + +baz + + + + ^self foo + + "Created: / 21-07-2010 / 16:00:21 / Jan Vrany " +! + +qux + + + + ^self foo + + "Created: / 21-07-2010 / 16:02:29 / Jan Vrany " +! + +foo + + ^#foo + + "Created: / 01-07-2010 / 18:09:55 / Jan Vrany " + "Modified: / 01-07-2010 / 20:46:39 / Jan Vrany " +! ! + +!SelectorNamespacesTests methodsFor:'tests'! + +test_01 + + self assert: self foo == #foo. + self assert: self bar == #foo_NS1 + + "Created: / 01-07-2010 / 18:47:18 / Jan Vrany " + "Modified: / 21-07-2010 / 15:59:27 / Jan Vrany " +! + +test_02 + + "Basic imports" + + self assert: + ((NameSpace name: #TestNS3) imports includes: (NameSpace name: #TestNS2)). + self assert: self baz == #foo_NS2. + + "Created: / 21-07-2010 / 16:05:00 / Jan Vrany " + "Modified: / 21-07-2010 / 17:19:00 / Jan Vrany " +! + +test_03 + + "Ambiguous send" + "Disable, I need a kind of unwind-protect on a C level. + Is that possible?" + + self shouldnt:[self qux] raise: AmbiguousMessage. + self assert: ambiguousMessageSelector == #foo. + + "Created: / 19-08-2010 / 22:28:19 / Jan Vrany " +! ! + +!SelectorNamespacesTests class methodsFor:'documentation'! + +version_CVS + ^ '$Header$' +! + +version_SVN + ^ ' Id: SelectorNamespacesTests.st 10567 2010-08-19 20:39:34Z vranyj1 ' +! !