[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-smalltalk] [PATCH 1/2] stinst: Add a pool look-up test for GNUPlot
From: |
Holger Hans Peter Freyther |
Subject: |
[Help-smalltalk] [PATCH 1/2] stinst: Add a pool look-up test for GNUPlot.GNUPlot like conditions. |
Date: |
Thu, 19 Dec 2013 16:12:20 +0100 |
---
packages/stinst/parser/PoolResolutionTests.st | 27 +++++++++++++++++++++++++--
packages/stinst/parser/STSymTable.st | 25 ++++++++++++++++++++++++-
2 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/packages/stinst/parser/PoolResolutionTests.st
b/packages/stinst/parser/PoolResolutionTests.st
index 197fae8..9d6d06c 100644
--- a/packages/stinst/parser/PoolResolutionTests.st
+++ b/packages/stinst/parser/PoolResolutionTests.st
@@ -7,7 +7,7 @@
"======================================================================
|
-| Copyright (C) 2008 Free Software Foundation, Inc.
+| Copyright (C) 2008,2013 Free Software Foundation, Inc.
| Written by Stephen Compall.
|
| This file is part of the GNU Smalltalk class library.
@@ -38,6 +38,17 @@ superclass only' namespace-walk-stop rule"
MyLibrary at: #PkgVersion put: 'MyLibrary 1.0'.
MyProject at: #PkgVersion put: 'MyProject 0.3141'.
+
+
+Namespace current: Smalltalk [
+ Namespace current: DoubleName [
+ Object subclass: DoubleName [
+ <comment: 'My name is the name of the namespace. This happens
+ with GNUPlot, Cairo and other packages.'>
+ ]
+ ]
+]
+
Namespace current: STInST.Tests.MyLibrary [
Eval [
@@ -99,7 +110,7 @@ MyProject.MyLibWrapper.Baz subclass: BackForMore [
Namespace current: STInST.Tests [
TestCase subclass: TestDefaultPoolResolution [
- | foo bar baz blah backformore |
+ | foo bar baz blah backformore doubleNameFirst doubleNameLast |
assertVariable: symbol of: pools is: value description: str [
| binding |
@@ -114,6 +125,11 @@ TestCase subclass: TestDefaultPoolResolution [
blah := DefaultPoolResolution of: MyLibrary.Blah.
baz := DefaultPoolResolution of: MyProject.MyLibWrapper.Baz.
backformore := DefaultPoolResolution of: MyLibrary.BackForMore.
+
+ doubleNameFirst := DefaultPoolResolution of: UndefinedObject.
+ doubleNameFirst addPoolFirst: DoubleName.
+ doubleNameLast := DefaultPoolResolution of: UndefinedObject.
+ doubleNameLast addPoolLast: DoubleName.
]
testClassPoolFirst [
@@ -150,6 +166,13 @@ TestCase subclass: TestDefaultPoolResolution [
self assertVariable: #Scoobs of: backformore is: 785
description: 'superclass ns pools inherited'.
]
+
+ testDoubleName [
+ self assertVariable: #DoubleName of: doubleNameFirst
+ is: Smalltalk.DoubleName.DoubleName description: 'the class is
found'.
+ self assertVariable: #DoubleName of: doubleNameLast
+ is: Smalltalk.DoubleName description: 'the name is found'.
+ ]
]
TestCase subclass: TestClassicPoolResolution [
diff --git a/packages/stinst/parser/STSymTable.st
b/packages/stinst/parser/STSymTable.st
index abf5297..40e5625 100644
--- a/packages/stinst/parser/STSymTable.st
+++ b/packages/stinst/parser/STSymTable.st
@@ -7,7 +7,7 @@
"======================================================================
|
-| Copyright 1995,1999,2000,2001,2002,2006,2007,2008 Free Software Foundation,
Inc.
+| Copyright 1995,1999,2000,2001,2002,2006,2007,2008,2013 Free Software
Foundation, Inc.
| Written by Steve Byrne.
|
| This file is part of GNU Smalltalk.
@@ -518,6 +518,13 @@ use compiling methods for that class.'>
^addedPool
]
+ addPoolFirst: poolDictionary [
+ "My implementation does nothing; you must override it if you
+ want it. Look at addPoolLast:"
+ <category: 'overriding'>
+ ^false
+ ]
+
addPoolLast: poolDictionary [
"If it is sensible, add poolDictionary to the end of my pool
search order, setting aside whatever standards I usually use
@@ -569,6 +576,14 @@ PoolResolution subclass: ClassicPoolResolution [
before the PoolResolution hierarchy was added, and TwistedPools became
default.'>
+ addPoolFirst: poolDictionary [
+ "Add poolDictionary and all superspaces to the end of the
+ search order. Always succeed."
+ <category: 'accessing'>
+ pools addAllFirst: poolDictionary withAllSuperspaces.
+ ^true
+ ]
+
addPoolLast: poolDictionary [
"Add poolDictionary and all superspaces to the end of the
search order. Always succeed."
@@ -611,6 +626,14 @@ expect things to be found in their own namespace first.
This is more
fully explained by my implementation, or at GNU Smalltalk wiki page
PoolResolution.'>
+ addPoolFirst: poolDictionary [
+ "Add poolDictionary and all superspaces to the end of the
+ search order. Always succeed."
+ <category: 'accessing'>
+ pools addAllFirst: poolDictionary withAllSuperspaces.
+ ^true
+ ]
+
addPoolLast: poolDictionary [
"Add poolDictionary and all superspaces to the end of the
search order. Always succeed."
--
1.8.5.1
- [Help-smalltalk] [PATCH 1/2] stinst: Add a pool look-up test for GNUPlot.GNUPlot like conditions.,
Holger Hans Peter Freyther <=