From 7eb691a7b61ba895695bbbf92e944d98ef49390d Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Mon, 20 Feb 2012 17:44:49 +0000 Subject: [clang.py] Implement Type.__eq__ and Type.__ne__ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150969 91177308-0d34-0410-b5e6-96231b3b80d8 --- bindings/python/tests/cindex/test_type.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'bindings/python/tests') diff --git a/bindings/python/tests/cindex/test_type.py b/bindings/python/tests/cindex/test_type.py index c4869fdd5a..b07ef643bd 100644 --- a/bindings/python/tests/cindex/test_type.py +++ b/bindings/python/tests/cindex/test_type.py @@ -109,6 +109,31 @@ def testConstantArray(): else: assert False, "Didn't find teststruct??" +def test_equal(): + """Ensure equivalence operators work on Type.""" + source = 'int a; int b; void *v;' + tu = get_tu(source) + + a, b, v = None, None, None + + for cursor in tu.cursor.get_children(): + if cursor.spelling == 'a': + a = cursor + elif cursor.spelling == 'b': + b = cursor + elif cursor.spelling == 'v': + v = cursor + + assert a is not None + assert b is not None + assert v is not None + + assert a.type == b.type + assert a.type != v.type + + assert a.type != None + assert a.type != 'foo' + def test_is_pod(): tu = get_tu('int i; void f();') i, f = None, None -- cgit v1.2.3-70-g09d2