flatbuffers/tests
Max Burke 355dfd48d1 [rust] Make enum names public (#5690)
* Bugfix for Rust generation of union fields named with language keywords

Looking at ParseField, it appears that in the case of unions, an extra field with a `UnionTypeFieldSuffix` is added to the type definition, however, if the name of this field is a keyword in the target language, it isn't escaped.

For example, if generating code for rust for a union field named `type`, flatc will generate a (non-keyword escaped) field named `type_type` for this hidden union field, and one (keyword escaped) called `type_` for the actual union contents.

When the union accessors are generated, they refer to this `type_type` field, but they will escape it mistakenly, generating code like this:

```
  #[inline]
  #[allow(non_snake_case)]
  pub fn type__as_int(&self) -> Option<Int<'a>> {
    if self.type__type() == Type::Int {
      self.type_().map(|u| Int::init_from_table(u))
    } else {
      None
    }
  }
```

Which will fail to build because the field is called `self.type_type()`, not `self.type__type()`.

* [Rust] Add crate-relative use statements for FBS includes.

At present if a flatbuffer description includes a reference to a type in
another file, the generated Rust code needs to be hand-modified to add
the appropriate `use` statements.

This assumes that the dependencies are built into the same crate, which
I think is a reasonable assumption?

* Revert "[Rust] Add crate-relative use statements for FBS includes."

This reverts commit d554d79fecf5afd6da6fb993b30b4cd523a5889a.

* Address comments raised in PR

* Update documentation comments per feedback

* Fix typo

* [rust] Make enum variant names public.

* Update generated test files

* Add test for public enum names
2019-12-31 10:28:58 -08:00
..
cpp17 [C++] Add Builder and Table typedefs (#5685) 2019-12-26 14:56:46 -08:00
docker CI: New Docker tests for Python with numpy (#5677) 2019-12-24 02:14:55 -05:00
evolution_test [C++] Adds basic schema evolution tests (#5611) 2019-11-14 15:44:18 -08:00
FlatBuffers.Benchmarks
FlatBuffers.Test [C++, Java, C#, TypeScript, JavaScript] Skip generation of mutable union types (#5599) 2019-11-04 14:54:44 -08:00
fuzzer Remove a static_assert (#5643) 2019-12-02 14:13:28 -08:00
include_test
MyGame Optimize Pack method using numpy (#5662) 2019-12-26 21:42:11 -05:00
namespace_test [rust] Make enum names public (#5690) 2019-12-31 10:28:58 -08:00
prototest Improve import handling for proto conversion (#5673) 2019-12-23 08:50:29 -08:00
rust_usage_test [rust] Make enum names public (#5690) 2019-12-31 10:28:58 -08:00
union_vector [C++] Add Builder and Table typedefs (#5685) 2019-12-26 14:56:46 -08:00
arrays_test.bfbs Fix incorrect padding in arrays of structs (Issue #5484) (#5491) 2019-08-23 10:46:47 -07:00
arrays_test.fbs Fix incorrect padding in arrays of structs (Issue #5484) (#5491) 2019-08-23 10:46:47 -07:00
arrays_test.golden Fix incorrect padding in arrays of structs (Issue #5484) (#5491) 2019-08-23 10:46:47 -07:00
arrays_test.schema.json Fix incorrect padding in arrays of structs (Issue #5484) (#5491) 2019-08-23 10:46:47 -07:00
arrays_test_generated.h [C++] Add Builder and Table typedefs (#5685) 2019-12-26 14:56:46 -08:00
BUILD Fix --incompatible_load_cc_rules_from_bzl (#5683) 2019-12-26 10:03:22 -08:00
DartTest.sh
generate_code.bat Add flatc '--cpp_std' switch (#5656) 2019-12-23 12:13:48 -08:00
generate_code.sh Add flatc '--cpp_std' switch (#5656) 2019-12-23 12:13:48 -08:00
go_test.go [Go] Object API support (#5339) 2019-10-31 11:13:45 -07:00
GoTest.sh [Go] Object API support (#5339) 2019-10-31 11:13:45 -07:00
JavaScriptTest.js
JavaScriptTest.sh
JavaScriptUnionVectorTest.js
JavaTest.bat
javatest.bin Fixed warnings generated by recent JSON sorting feature. 2019-10-17 15:16:40 -07:00
JavaTest.java [C++, Java, C#, TypeScript, JavaScript] Skip generation of mutable union types (#5599) 2019-11-04 14:54:44 -08:00
JavaTest.sh [FlexBuffers][Java] Implementation of FlexBuffers API (#5476) 2019-08-29 15:06:24 -07:00
KotlinTest.kt Add basic Kotlin support (#5409) 2019-07-22 16:05:15 -07:00
KotlinTest.sh Add basic Kotlin support (#5409) 2019-07-22 16:05:15 -07:00
lobstertest.lobster
LuaTest.bat
luatest.lua Lua cleanup (#5624) 2019-11-14 15:46:46 -08:00
LuaTest.sh Fix for Boolean types (#5379) (#5466) 2019-08-01 10:28:54 -07:00
monster_extra.fbs Extend the test of MonsterExtra (#5428) 2019-07-08 11:22:56 -07:00
monster_extra_generated.h [C++] Add Builder and Table typedefs (#5685) 2019-12-26 14:56:46 -08:00
monster_test.bfbs [Javascript] Fix syntax error for signed enum (#5503) 2019-09-05 10:22:04 -07:00
monster_test.fbs [Javascript] Fix syntax error for signed enum (#5503) 2019-09-05 10:22:04 -07:00
monster_test.grpc.fb.cc
monster_test.grpc.fb.h
monster_test.schema.json [Javascript] Fix syntax error for signed enum (#5503) 2019-09-05 10:22:04 -07:00
monster_test_generated.h [C++] Add Builder and Table typedefs (#5685) 2019-12-26 14:56:46 -08:00
monster_test_generated.js [C++, Java, C#, TypeScript, JavaScript] Skip generation of mutable union types (#5599) 2019-11-04 14:54:44 -08:00
monster_test_generated.lobster [Javascript] Fix syntax error for signed enum (#5503) 2019-09-05 10:22:04 -07:00
monster_test_generated.rs [rust] Make enum names public (#5690) 2019-12-31 10:28:58 -08:00
monster_test_generated.ts [C++, Java, C#, TypeScript, JavaScript] Skip generation of mutable union types (#5599) 2019-11-04 14:54:44 -08:00
monster_test_my_game.example2_generated.dart
monster_test_my_game.example_generated.dart [Javascript] Fix syntax error for signed enum (#5503) 2019-09-05 10:22:04 -07:00
monster_test_my_game_generated.dart
monsterdata_extra.json Extend the test of MonsterExtra (#5428) 2019-07-08 11:22:56 -07:00
monsterdata_python_wire.mon Python: Added support for file_identifiers (#5123) 2019-07-26 11:06:25 -07:00
monsterdata_test.golden Support nested_flatbuffer attribute when parsing bfbs schema (#5448) 2019-07-26 09:13:11 -07:00
monsterdata_test.json
monsterdata_test.mon
native_type_test.fbs [C++] remove static_cast expression (#5440) 2019-08-01 14:31:48 -07:00
native_type_test_generated.h [C++] Add Builder and Table typedefs (#5685) 2019-12-26 14:56:46 -08:00
native_type_test_impl.cpp [C++] Refactor to conform to Google C++ style guide (#5608) 2019-11-07 12:22:54 -08:00
native_type_test_impl.h [C++] Refactor to conform to Google C++ style guide (#5608) 2019-11-07 12:22:54 -08:00
phpTest.php
phpUnionVectorTest.php
phpUnionVectorTest.sh
py_test.py CI: New Docker tests for Python with numpy (#5677) 2019-12-24 02:14:55 -05:00
PythonTest.sh Flatbuffers Python Object API (#5616) 2019-12-02 14:11:28 -08:00
RustTest.bat
RustTest.sh
test.cpp Removed test proto output. 2019-12-23 12:33:16 -08:00
test_assert.cpp Fix ambiguity of a type deduction in TEST_EQ macro if arguments have enum class type. (#5630) 2019-11-25 12:56:47 -08:00
test_assert.h wrap multiple statements in do {} while(!IsConstTrue(true)) (#5655) 2019-12-13 10:14:14 -08:00
test_builder.cpp Add flatc '--cpp_std' switch (#5656) 2019-12-23 12:13:48 -08:00
test_builder.h Add flatc '--cpp_std' switch (#5656) 2019-12-23 12:13:48 -08:00
TestAll.sh Add basic Kotlin support (#5409) 2019-07-22 16:05:15 -07:00
TypeScriptTest.sh
unicode_test.json Fixed JSON parser not sorting vectors of tables/structs with key. 2019-10-10 15:25:39 -07:00