test for 'first assignment' algorithm
authorStefan Behnel <scoder@users.berlios.de>
Sun, 4 Oct 2009 19:44:03 +0000 (21:44 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Sun, 4 Oct 2009 19:44:03 +0000 (21:44 +0200)
tests/compile/first_assignment.pyx [new file with mode: 0644]

diff --git a/tests/compile/first_assignment.pyx b/tests/compile/first_assignment.pyx
new file mode 100644 (file)
index 0000000..2bd74d0
--- /dev/null
@@ -0,0 +1,31 @@
+
+cimport cython
+
+@cython.test_assert_path_exists(
+    "//SingleAssignmentNode",
+    "//SingleAssignmentNode[./NameNode[@name = 'a']]",
+    "//SingleAssignmentNode[./NameNode[@name = 'a'] and @first = True]",
+    )
+def test_cdef():
+    cdef int a = 1
+
+@cython.test_assert_path_exists(
+    "//SingleAssignmentNode",
+    "//SingleAssignmentNode[./NameNode[@name = 'a']]",
+# FIXME: currently not working
+#    "//SingleAssignmentNode[./NameNode[@name = 'a'] and @first = True]",
+    )
+def test_py():
+    a = 1
+
+@cython.test_assert_path_exists(
+    "//SingleAssignmentNode",
+    "//SingleAssignmentNode[./NameNode[@name = 'a']]",
+# FIXME: currently not working
+#    "//SingleAssignmentNode[./NameNode[@name = 'a'] and @first = True]",
+    )
+def test_cond():
+    if True:
+        a = 1
+    else:
+        a = 2