summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWouter van Oortmerssen <wvo@google.com>2016-04-11 17:36:56 -0700
committerWouter van Oortmerssen <wvo@google.com>2016-04-11 17:36:56 -0700
commit72fc45aa6acbc11052c6baa462fac26c5075392a (patch)
tree88d0c4125a285e49c85443d22f644f795670f878 /tests
parent9f2b05df1b161efe48bcdbb5c589dc4cbf281fcb (diff)
downloadflatbuffers-72fc45aa6acbc11052c6baa462fac26c5075392a.tar.gz
flatbuffers-72fc45aa6acbc11052c6baa462fac26c5075392a.tar.bz2
flatbuffers-72fc45aa6acbc11052c6baa462fac26c5075392a.zip
Made user-defined attributes available in the reflection data.
Tested: on Linux. Bug: 27923233 Change-Id: Ic16675650e4a8e138c163f1e2131a3aad7008ada
Diffstat (limited to 'tests')
-rw-r--r--tests/monster_test.bfbsbin2744 -> 2840 bytes
-rw-r--r--tests/namespace_test/namespace_test2_generated.h10
-rw-r--r--tests/test.cpp4
3 files changed, 4 insertions, 10 deletions
diff --git a/tests/monster_test.bfbs b/tests/monster_test.bfbs
index e5f51fac..db123282 100644
--- a/tests/monster_test.bfbs
+++ b/tests/monster_test.bfbs
Binary files differ
diff --git a/tests/namespace_test/namespace_test2_generated.h b/tests/namespace_test/namespace_test2_generated.h
index 1831454c..d0cc5fab 100644
--- a/tests/namespace_test/namespace_test2_generated.h
+++ b/tests/namespace_test/namespace_test2_generated.h
@@ -8,16 +8,6 @@
#include "namespace_test1_generated.h"
namespace NamespaceA {
-namespace NamespaceB {
-
-struct TableInNestedNS;
-
-struct StructInNestedNS;
-
-} // namespace NamespaceB
-} // namespace NamespaceA
-
-namespace NamespaceA {
struct TableInFirstNS;
diff --git a/tests/test.cpp b/tests/test.cpp
index 42c7647a..4c3aa543 100644
--- a/tests/test.cpp
+++ b/tests/test.cpp
@@ -322,6 +322,10 @@ void ReflectionTest(uint8_t *flatbuf, size_t length) {
TEST_EQ_STR(hp_field.name()->c_str(), "hp");
TEST_EQ(hp_field.id(), 2);
TEST_EQ(hp_field.type()->base_type(), reflection::Short);
+ auto friendly_field_ptr = fields->LookupByKey("friendly");
+ TEST_NOTNULL(friendly_field_ptr);
+ TEST_NOTNULL(friendly_field_ptr->attributes());
+ TEST_NOTNULL(friendly_field_ptr->attributes()->LookupByKey("priority"));
// Now use it to dynamically access a buffer.
auto &root = *flatbuffers::GetAnyRoot(flatbuf);