~ubuntu-branches/ubuntu/karmic/pypy/karmic

« back to all changes in this revision

Viewing changes to pypy/translator/js/test/test_rpbc.py

  • Committer: Bazaar Package Importer
  • Author(s): Alexandre Fayolle
  • Date: 2007-04-13 09:33:09 UTC
  • Revision ID: james.westby@ubuntu.com-20070413093309-yoojh4jcoocu2krz
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
import py
 
3
from pypy.translator.js.test.runtest import JsTest
 
4
from pypy.rpython.test.test_rpbc import BaseTestRPBC
 
5
 
 
6
class TestJsPBC(JsTest, BaseTestRPBC):
 
7
    def test_single_pbc_getattr(self):
 
8
        class C:
 
9
            def __init__(self, v1, v2):
 
10
                self.v1 = v1
 
11
                self.v2 = v2
 
12
            def _freeze_(self):
 
13
                return True
 
14
        c1 = C(11, lambda: "hello")
 
15
        c2 = C(22, lambda: 623)
 
16
        def f1(l, c):
 
17
            l.append(c.v1)
 
18
        def f2(c):
 
19
            return c.v2
 
20
        def f3(c):
 
21
            return c.v2
 
22
        def g():
 
23
            l = []
 
24
            f1(l, c1)
 
25
            f1(l, c2)
 
26
            return f2(c1)(), f3(c2)()
 
27
 
 
28
        res = self.interpret(g, [])
 
29
        assert res[0] == "hello"
 
30
        assert res[1] == 623
 
31
 
 
32
    def test_call_memoized_function_with_bools(self):
 
33
        py.test.skip("WIP")
 
34
 
 
35
    def test_conv_from_None(self):
 
36
        py.test.skip("WIP")
 
37
 
 
38
 
 
39