Armin Rigo avatar Armin Rigo committed 6dfef8d Draft

Progress.

Comments (0)

Files changed (1)

pypy/module/_continuation/test/test_stacklet.py

         raises(error, c.switch)
 
     def test_go_depth2(self):
-        from _continuation import new
+        from _continuation import continuation
         #
-        def depth2(h):
+        def depth2(c):
+            seen.append(3)
+            return 4
+        #
+        def depth1(c):
+            seen.append(1)
+            c2 = continuation(depth2)
             seen.append(2)
-            return h
-        #
-        def depth1(h):
-            seen.append(1)
-            h2 = new(depth2)
-            assert h2 is None
-            seen.append(3)
-            return h
+            res = c2.switch()
+            seen.append(res)
+            return 5
         #
         seen = []
-        h = new(depth1)
-        assert h is None
-        assert seen == [1, 2, 3]
+        c = continuation(depth1)
+        seen.append(0)
+        res = c.switch()
+        seen.append(res)
+        assert seen == [0, 1, 2, 3, 4, 5]
 
     def test_exception_depth2(self):
-        from _continuation import new
+        from _continuation import continuation
         #
-        def depth2(h):
+        def depth2(c):
             seen.append(2)
             raise ValueError
         #
-        def depth1(h):
+        def depth1(c):
             seen.append(1)
             try:
-                new(depth2)
+                continuation(depth2).switch()
             except ValueError:
                 seen.append(3)
-            return h
+            return 4
         #
         seen = []
-        h = new(depth1)
-        assert h is None
-        assert seen == [1, 2, 3]
+        c = continuation(depth1)
+        res = c.switch()
+        seen.append(res)
+        assert seen == [1, 2, 3, 4]
 
     def test_exception_with_switch(self):
         from _continuation import new
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.