Commit ed8e6972 authored by Stefan Behnel's avatar Stefan Behnel

extend C++ tests to make sure we do not generate warnings (and fix some...

extend C++ tests to make sure we do not generate warnings (and fix some warnings that we did generate)
parent 722d3039
# tag: cpp # mode: run
# tag: cpp, werror
from libcpp cimport bool from libcpp cimport bool
......
# tag: cpp # mode: run
# tag: cpp, werror
from libcpp.vector cimport vector from libcpp.vector cimport vector
......
# mode: run
# tag: cpp, werror
# cython: experimental_cpp_class_def=True # cython: experimental_cpp_class_def=True
# tag: cpp
from libcpp.vector cimport vector from libcpp.vector cimport vector
......
# tag: cpp # mode: run
# tag: cpp, werror
PYTHON setup.py build_ext --inplace PYTHON setup.py build_ext --inplace
PYTHON -c "import a; a.test_convert()" PYTHON -c "import a; a.test_convert()"
......
# tag: cpp # mode: run
# tag: cpp, werror
cdef int raise_py_error() except *: cdef int raise_py_error() except *:
raise TypeError("custom") raise TypeError("custom")
......
# tag: cpp # mode: run
# tag: cpp, werror
cdef int raise_TypeError() except *: cdef int raise_TypeError() except *:
raise TypeError("custom") raise TypeError("custom")
......
# tag: cpp # mode: run
# tag: cpp, werror
from libcpp.vector cimport vector from libcpp.vector cimport vector
from cython.operator cimport dereference as deref from cython.operator cimport dereference as deref
...@@ -89,6 +90,6 @@ def test_iteration_in_generator_reassigned(): ...@@ -89,6 +90,6 @@ def test_iteration_in_generator_reassigned():
vint = new vector[int]() vint = new vector[int]()
vint.push_back(2) vint.push_back(2)
finally: finally:
del orig_vint
if vint is not orig_vint: if vint is not orig_vint:
del vint del vint
del orig_vint
# tag: cpp # mode: run
# tag: cpp, werror
cdef extern from "cpp_namespaces_helper.h" namespace "A": cdef extern from "cpp_namespaces_helper.h" namespace "A":
ctypedef int A_t ctypedef int A_t
......
# tag: cpp # mode: run
# tag: cpp, werror
from cython.operator cimport dereference as deref from cython.operator cimport dereference as deref
......
# tag: cpp # mode: run
# tag: cpp, werror
from cython cimport typeof from cython cimport typeof
......
# tag: cpp # mode: run
# tag: cpp, werror
cdef extern from "vector" namespace "std": cdef extern from "vector" namespace "std":
......
# tag: cpp # mode: run
## Re-enable once our buildbot gcc is upgraded to a less-than-seven year old release. # tag: cpp, werror
## distutils: extra_compile_args=-std=c++0x # distutils: extra_compile_args=-std=c++0x
import sys import sys
from libcpp.map cimport map from libcpp.map cimport map
#from libcpp.unordered_map cimport unordered_map from libcpp.unordered_map cimport unordered_map
from libcpp.set cimport set as cpp_set from libcpp.set cimport set as cpp_set
#from libcpp.unordered_set cimport unordered_set from libcpp.unordered_set cimport unordered_set
from libcpp.string cimport string from libcpp.string cimport string
from libcpp.pair cimport pair from libcpp.pair cimport pair
from libcpp.vector cimport vector from libcpp.vector cimport vector
...@@ -162,17 +162,17 @@ def test_set(o): ...@@ -162,17 +162,17 @@ def test_set(o):
cdef cpp_set[long] s = o cdef cpp_set[long] s = o
return s return s
#def test_unordered_set(o): def test_unordered_set(o):
# """ """
# >>> sorted(test_unordered_set([1, 2, 3])) >>> sorted(test_unordered_set([1, 2, 3]))
# [1, 2, 3] [1, 2, 3]
# >>> sorted(test_unordered_set([1, 2, 3, 3])) >>> sorted(test_unordered_set([1, 2, 3, 3]))
# [1, 2, 3] [1, 2, 3]
# >>> type(test_unordered_set([])) is py_set >>> type(test_unordered_set([])) is py_set
# True True
# """ """
# cdef unordered_set[long] s = o cdef unordered_set[long] s = o
# return s return s
def test_map(o): def test_map(o):
""" """
...@@ -182,13 +182,13 @@ def test_map(o): ...@@ -182,13 +182,13 @@ def test_map(o):
cdef map[int, double] m = o cdef map[int, double] m = o
return m return m
#def test_unordered_map(o): def test_unordered_map(o):
# """ """
# >>> test_map({1: 1.0, 2: 0.5, 3: 0.25}) >>> test_map({1: 1.0, 2: 0.5, 3: 0.25})
# {1: 1.0, 2: 0.5, 3: 0.25} {1: 1.0, 2: 0.5, 3: 0.25}
# """ """
# cdef unordered_map[int, double] m = o cdef unordered_map[int, double] m = o
# return m return m
def test_nested(o): def test_nested(o):
""" """
......
# tag: cpp # mode: run
# tag: cpp, werror
cimport cython cimport cython
......
# mode: run # mode: run
# tag: cpp # tag: cpp, werror
# cython: c_string_encoding=ascii, c_string_type=unicode # cython: c_string_encoding=ascii, c_string_type=unicode
cimport cython cimport cython
......
# mode: run # mode: run
# tag: cpp # tag: cpp, werror
# cython: c_string_encoding=ascii, c_string_type=str # cython: c_string_encoding=ascii, c_string_type=str
cimport cython cimport cython
......
# tag: cpp # mode: run
# tag: cpp, werror
from cython.operator import dereference as deref from cython.operator import dereference as deref
from libcpp.pair cimport pair from libcpp.pair cimport pair
......
# tag: cpp # mode: run
# tag: cpp, werror
from cython cimport typeof from cython cimport typeof
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment