[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] [patch] represent <test/> packages with TestPackage

From: Stephen Compall
Subject: [Help-smalltalk] [patch] represent <test/> packages with TestPackage
Date: Sat, 23 Jun 2007 21:29:36 -0500
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv: Gecko/20070509 SeaMonkey/1.1.2

smalltalk--backstage--2.2--patch-38, against devo patch-410, adds class TestPackage. This fixes a bug where changes to an outer package during testing (i.e. namespace or directory) would not be propagated to the test package after it had been created, thus preventing Parser (and other expressible packages) from being added to the package db.

Also attached.

Stephen Compall
But you know how reluctant paranormal phenomena are to reveal
themselves when skeptics are present. --Robert Sheaffer, SkI 9/2003
2007-06-23  Stephen Compall  <address@hidden>

        * kernel/ Add class TestPackage, reifying its
        relationship with its owner package, and use it for all <test/>

--- orig/kernel/
+++ mod/kernel/
@@ -106,6 +106,25 @@
 information on a Smalltalk package, and can output my description in
+Namespace current: Kernel!
+Smalltalk.Package subclass: #TestPackage
+                 instanceVariableNames: 'owner'
+                 classVariableNames: ''
+                 poolDictionaries: ''
+                 category: 'Language-Packaging'
+TestPackage comment:
+'I am not part of a standard Smalltalk system.  I am an unnamed
+subpackage of a regular package, representing an SUnit test suite for
+that package.
+    owner
+       The Package I provide tests for; initialized by the owner.'!
+Namespace current: Smalltalk!
 Object subclass: #PackageLoader
        instanceVariableNames: ''
        classVariableNames: ''
@@ -690,10 +709,7 @@
     aPackage name isNil ifFalse: [
        self error: 'test package must not have names' ].
     aPackage prerequisites add: 'SUnit'; add: self name.
-    aPackage directory isNil ifTrue: [
-        aPackage directory: self directory ].
-    aPackage namespace isNil ifTrue: [
-        aPackage namespace: self namespace ].
+    aPackage owner: self.
     test := aPackage!
@@ -905,7 +921,7 @@
            ch isAlphaNumeric ifTrue: [
                tag := file upTo: $>.
                tag = 'test'
-                   ifTrue: [ self test: (Package new parse: file tag: tag) ]
+                   ifTrue: [ self test: (TestPackage new parse: file tag: tag) 
                    ifFalse: [ stack addLast: tag ].
                cdata trimSeparators isEmpty ifFalse: [
@@ -922,6 +938,24 @@
 ! !
+!Kernel.TestPackage methodsFor: 'accessing'!
+owner: aPackage
+    "Set the Package I test."
+    owner := aPackage.
+    "Answer the base directory from which to load the package."
+    ^super directory ifNil: [owner directory]
+    "Answer the namespace in which the package is loaded."
+    ^super namespace ifNil: [owner namespace]
+! !
 !PackageLoader class methodsFor: 'accessing'!
 packageAt: package

reply via email to

[Prev in Thread] Current Thread [Next in Thread]