Author: Lars Wassermann <[email protected]>
Branch:
Changeset: r105:34f9ef52753a
Date: 2013-02-27 15:02 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/34f9ef52753a/
Log: added two more bootstrappedimage tests, one of which will not work
until #allInstancesDo: works
diff --git a/spyvm/test/test_bootstrappedimage.py
b/spyvm/test/test_bootstrappedimage.py
--- a/spyvm/test/test_bootstrappedimage.py
+++ b/spyvm/test/test_bootstrappedimage.py
@@ -6,7 +6,7 @@
testhelper.setup_module(testhelper, filename='bootstrapped.image')
-def test_retrieve_symbol():
+def test_symbol_asSymbol():
w_result = perform(testhelper.image.w_asSymbol, "asSymbol")
assert w_result is testhelper.image.w_asSymbol
@@ -14,11 +14,21 @@
w_result = perform(w("someString"), "asSymbol")
assert w_result is not None
assert w_result.as_string() == "someString"
-
-#def test_hazelnut():
-# from spyvm.test import test_miniimage
-# setup_module(test_miniimage, filename='bootstrapped.image')
-# test_miniimage.test_all_pointers_are_valid()
-# test_miniimage.test_become()
- #test_miniimage.test_special_classes0()
+def test_retrieve_symbol():
+ py.test.skip("This implementation is based on a working allInstancesDo ->
implement primitive 77 and such")
+ """asSymbol
+ "This is the only place that new Symbols are created. A Symbol is created
+ if and only if there is not already a Symbol with its contents in
existance."
+ Symbol
+ allInstancesDo: [ :sym |
+ self = sym
+ ifTrue: [ ^ sym ] ].
+ ^ (Symbol basicNew: self size) initFrom: self"""
+ w_result = perform(w("someString"), "asSymbol")
+ w_anotherSymbol = perform(w("someString"), "asSymbol")
+ assert w_result is w_anotherSymbol
+
+
+def test_all_pointers_are_valid():
+ testhelper.test_all_pointers_are_valid()
\ No newline at end of file
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit