From fbc20b57a902c689e6f76f6c043ab34c47f75ef0 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 4 Oct 2009 21:44:03 +0200 Subject: [PATCH] test for 'first assignment' algorithm --- tests/compile/first_assignment.pyx | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/compile/first_assignment.pyx diff --git a/tests/compile/first_assignment.pyx b/tests/compile/first_assignment.pyx new file mode 100644 index 00000000..2bd74d02 --- /dev/null +++ b/tests/compile/first_assignment.pyx @@ -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 -- 2.26.2