Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r837:0b2a781c75d2 Date: 2012-08-12 23:56 +0200 http://bitbucket.org/cffi/cffi/changeset/0b2a781c75d2/
Log: Copy here from backend_tests diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -1069,6 +1069,12 @@ assert repr(cast(BEnum, '#-20')) == "<cdata 'enum foo' 'ab'>" assert repr(cast(BEnum, '#-21')) == "<cdata 'enum foo' '#-21'>" +def test_enum_with_non_injective_mapping(): + BEnum = new_enum_type("foo", ('ab', 'cd'), (7, 7)) + e = cast(BEnum, 7) + assert repr(e) == "<cdata 'enum foo' 'ab'>" + assert string(e) == 'ab' + def test_enum_in_struct(): BEnum = new_enum_type("foo", ('def', 'c', 'ab'), (0, 1, -20)) BStruct = new_struct_type("bar") _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit