summaryrefslogtreecommitdiffstats
path: root/bindings/python/tests/cindex/test_cursor.py
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/python/tests/cindex/test_cursor.py')
-rw-r--r--bindings/python/tests/cindex/test_cursor.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/bindings/python/tests/cindex/test_cursor.py b/bindings/python/tests/cindex/test_cursor.py
index a5224aa..c5ea505 100644
--- a/bindings/python/tests/cindex/test_cursor.py
+++ b/bindings/python/tests/cindex/test_cursor.py
@@ -97,6 +97,36 @@ def test_canonical():
assert len(cursors) == 3
assert cursors[1].canonical == cursors[2].canonical
+def test_is_const_method():
+ """Ensure Cursor.is_const_method works."""
+ source = 'class X { void foo() const; void bar(); };'
+ tu = get_tu(source, lang='cpp')
+
+ cls = get_cursor(tu, 'X')
+ foo = get_cursor(tu, 'foo')
+ bar = get_cursor(tu, 'bar')
+ assert cls is not None
+ assert foo is not None
+ assert bar is not None
+
+ assert foo.is_const_method()
+ assert not bar.is_const_method()
+
+def test_is_mutable_field():
+ """Ensure Cursor.is_mutable_field works."""
+ source = 'class X { int x_; mutable int y_; };'
+ tu = get_tu(source, lang='cpp')
+
+ cls = get_cursor(tu, 'X')
+ x_ = get_cursor(tu, 'x_')
+ y_ = get_cursor(tu, 'y_')
+ assert cls is not None
+ assert x_ is not None
+ assert y_ is not None
+
+ assert not x_.is_mutable_field()
+ assert y_.is_mutable_field()
+
def test_is_static_method():
"""Ensure Cursor.is_static_method works."""
@@ -113,6 +143,36 @@ def test_is_static_method():
assert foo.is_static_method()
assert not bar.is_static_method()
+def test_is_pure_virtual_method():
+ """Ensure Cursor.is_pure_virtual_method works."""
+ source = 'class X { virtual void foo() = 0; virtual void bar(); };'
+ tu = get_tu(source, lang='cpp')
+
+ cls = get_cursor(tu, 'X')
+ foo = get_cursor(tu, 'foo')
+ bar = get_cursor(tu, 'bar')
+ assert cls is not None
+ assert foo is not None
+ assert bar is not None
+
+ assert foo.is_pure_virtual_method()
+ assert not bar.is_pure_virtual_method()
+
+def test_is_virtual_method():
+ """Ensure Cursor.is_virtual_method works."""
+ source = 'class X { virtual void foo(); void bar(); };'
+ tu = get_tu(source, lang='cpp')
+
+ cls = get_cursor(tu, 'X')
+ foo = get_cursor(tu, 'foo')
+ bar = get_cursor(tu, 'bar')
+ assert cls is not None
+ assert foo is not None
+ assert bar is not None
+
+ assert foo.is_virtual_method()
+ assert not bar.is_virtual_method()
+
def test_underlying_type():
tu = get_tu('typedef int foo;')
typedef = get_cursor(tu, 'foo')
OpenPOWER on IntegriCloud