[gobject-introspection] [test] Add warning tests for enums
- From: Johan Dahlin <johan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] [test] Add warning tests for enums
- Date: Fri, 3 Sep 2010 02:29:20 +0000 (UTC)
commit d9f8c0002c9dbd9154b49d3b23c1bd85423760ab
Author: Johan Dahlin <johan gnome org>
Date: Thu Sep 2 23:28:43 2010 -0300
[test] Add warning tests for enums
giscanner/transformer.py | 6 +++---
tests/warn/unresolved-type.h | 12 ++++++++++++
2 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 120218f..a1f6193 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -279,7 +279,7 @@ raise ValueError."""
try:
(ns, name) = self.split_csymbol(ident)
except ValueError, e:
- raise TransformerException("Unknown namespace")
+ raise TransformerException(str(e))
if ns != self._namespace:
raise TransformerException(
"Skipping foreign symbol from namespace %s" % (ns.name, ))
@@ -353,7 +353,7 @@ raise ValueError."""
try:
name = self._strip_symbol(child, is_constant=True)
except TransformerException, e:
- message.warn_symbol(child, e)
+ message.warn_symbol(symbol, e)
return None
members.append(ast.Member(name.lower(),
child.const_int,
@@ -362,7 +362,7 @@ raise ValueError."""
try:
enum_name = self.strip_identifier(symbol.ident)
except TransformerException, e:
- message.warn(e)
+ message.warn_symbol(symbol, e)
return None
if symbol.base_type.is_bitfield:
klass = ast.Bitfield
diff --git a/tests/warn/unresolved-type.h b/tests/warn/unresolved-type.h
index 3ee92b7..9f1a05c 100644
--- a/tests/warn/unresolved-type.h
+++ b/tests/warn/unresolved-type.h
@@ -5,3 +5,15 @@ typedef struct {
} MyStruct;
// EXPECT:5: Warning: Test: symbol='MyStruct': Unknown namespace for identifier 'MyStruct'
+
+typedef enum {
+ TEST_MY_ENUM_A = 0
+} MyEnum;
+
+// EXPECT:11: Warning: Test: symbol='MyEnum': Unknown namespace for identifier 'MyEnum'
+
+typedef enum {
+ MY_ENUM_A = 0
+} TestMyEnum2;
+
+// EXPECT:17: Warning: Test: symbol='TestMyEnum2': Unknown namespace for symbol 'my_enum_a'
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]