diff options
author | nsrtvwls <oakjumper@gmail.com> | 2018-09-28 08:11:21 -0700 |
---|---|---|
committer | James E. King III <jking@apache.org> | 2018-09-28 11:11:21 -0400 |
commit | 014f53f6582fbae8146ae291d471382016091a06 (patch) | |
tree | ebd77be07d6be35c8c840278688bb2fee0a94c1a /compiler/cpp/test | |
parent | c64389a194fe1516fef5830151dfb8b35f6c6bb2 (diff) | |
download | thrift-014f53f6582fbae8146ae291d471382016091a06.tar.gz |
THRIFT-4496: python specific list of keywords for python generator (#1567)
Client: py
Diffstat (limited to 'compiler/cpp/test')
15 files changed, 44 insertions, 1 deletions
diff --git a/compiler/cpp/test/CMakeLists.txt b/compiler/cpp/test/CMakeLists.txt index 7cf98a517..a09f23d7c 100644 --- a/compiler/cpp/test/CMakeLists.txt +++ b/compiler/cpp/test/CMakeLists.txt @@ -76,5 +76,17 @@ if(${WITH_PLUGIN}) -P ${CMAKE_CURRENT_SOURCE_DIR}/cpp_plugin_test.cmake) endif() +file(GLOB KEYWORD_SAMPLES "${CMAKE_CURRENT_SOURCE_DIR}/keyword-samples/*.thrift") +foreach(LANG ${thrift_compiler_LANGS}) + foreach(SAMPLE ${KEYWORD_SAMPLES}) + get_filename_component(FILENAME ${SAMPLE} NAME_WE) + add_test(NAME "${LANG}_${FILENAME}" + COMMAND thrift-compiler --gen ${LANG} ${SAMPLE}) + set_tests_properties("${LANG}_${FILENAME}" PROPERTIES + PASS_REGULAR_EXPRESSION "Cannot use reserved language keyword") + endforeach() +endforeach() + + find_package(PythonInterp REQUIRED) -add_test(NAME StalenessCheckTest COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/compiler/staleness_check.py ${THRIFT_COMPILER})
\ No newline at end of file +add_test(NAME StalenessCheckTest COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/compiler/staleness_check.py ${THRIFT_COMPILER}) diff --git a/compiler/cpp/test/keyword-samples/const1_return.thrift b/compiler/cpp/test/keyword-samples/const1_return.thrift new file mode 100644 index 000000000..735e4acd8 --- /dev/null +++ b/compiler/cpp/test/keyword-samples/const1_return.thrift @@ -0,0 +1 @@ +const bool return = 0 diff --git a/compiler/cpp/test/keyword-samples/enum1_return.thrift b/compiler/cpp/test/keyword-samples/enum1_return.thrift new file mode 100644 index 000000000..6d834e1da --- /dev/null +++ b/compiler/cpp/test/keyword-samples/enum1_return.thrift @@ -0,0 +1,2 @@ +enum return { +} diff --git a/compiler/cpp/test/keyword-samples/enum2_return.thrift b/compiler/cpp/test/keyword-samples/enum2_return.thrift new file mode 100644 index 000000000..a2caa8e14 --- /dev/null +++ b/compiler/cpp/test/keyword-samples/enum2_return.thrift @@ -0,0 +1,3 @@ +enum enum_name { + return +} diff --git a/compiler/cpp/test/keyword-samples/exception1_return.thrift b/compiler/cpp/test/keyword-samples/exception1_return.thrift new file mode 100644 index 000000000..eadb33834 --- /dev/null +++ b/compiler/cpp/test/keyword-samples/exception1_return.thrift @@ -0,0 +1 @@ +exception return {} diff --git a/compiler/cpp/test/keyword-samples/exception2_return.thrift b/compiler/cpp/test/keyword-samples/exception2_return.thrift new file mode 100644 index 000000000..493c35297 --- /dev/null +++ b/compiler/cpp/test/keyword-samples/exception2_return.thrift @@ -0,0 +1,3 @@ +exception exception_name { + 1: required i8 return +} diff --git a/compiler/cpp/test/keyword-samples/service1_return.thrift b/compiler/cpp/test/keyword-samples/service1_return.thrift new file mode 100644 index 000000000..5286a3691 --- /dev/null +++ b/compiler/cpp/test/keyword-samples/service1_return.thrift @@ -0,0 +1 @@ +service return {} diff --git a/compiler/cpp/test/keyword-samples/service2_return.thrift b/compiler/cpp/test/keyword-samples/service2_return.thrift new file mode 100644 index 000000000..6f7331da0 --- /dev/null +++ b/compiler/cpp/test/keyword-samples/service2_return.thrift @@ -0,0 +1,3 @@ +service service_name { + bool function_name(1: i32 return) +} diff --git a/compiler/cpp/test/keyword-samples/service3_return.thrift b/compiler/cpp/test/keyword-samples/service3_return.thrift new file mode 100644 index 000000000..c6dd946fd --- /dev/null +++ b/compiler/cpp/test/keyword-samples/service3_return.thrift @@ -0,0 +1,3 @@ +service service_name { + void return() +} diff --git a/compiler/cpp/test/keyword-samples/service4_return.thrift b/compiler/cpp/test/keyword-samples/service4_return.thrift new file mode 100644 index 000000000..d0787dfde --- /dev/null +++ b/compiler/cpp/test/keyword-samples/service4_return.thrift @@ -0,0 +1,5 @@ +exception exception_name {} + +service service_name { + void function_name() throws ( 1: exception_name return) +} diff --git a/compiler/cpp/test/keyword-samples/struct1_return.thrift b/compiler/cpp/test/keyword-samples/struct1_return.thrift new file mode 100644 index 000000000..c82b8b9ca --- /dev/null +++ b/compiler/cpp/test/keyword-samples/struct1_return.thrift @@ -0,0 +1 @@ +struct return {} diff --git a/compiler/cpp/test/keyword-samples/struct2_return.thrift b/compiler/cpp/test/keyword-samples/struct2_return.thrift new file mode 100644 index 000000000..a0700d101 --- /dev/null +++ b/compiler/cpp/test/keyword-samples/struct2_return.thrift @@ -0,0 +1,3 @@ +struct struct_name { + 1: required bool return = 1 +} diff --git a/compiler/cpp/test/keyword-samples/typedef1_return.thrift b/compiler/cpp/test/keyword-samples/typedef1_return.thrift new file mode 100644 index 000000000..f159bb880 --- /dev/null +++ b/compiler/cpp/test/keyword-samples/typedef1_return.thrift @@ -0,0 +1 @@ +typedef bool return diff --git a/compiler/cpp/test/keyword-samples/union1_return.thrift b/compiler/cpp/test/keyword-samples/union1_return.thrift new file mode 100644 index 000000000..368df1383 --- /dev/null +++ b/compiler/cpp/test/keyword-samples/union1_return.thrift @@ -0,0 +1 @@ +union return {} diff --git a/compiler/cpp/test/keyword-samples/union2_return.thrift b/compiler/cpp/test/keyword-samples/union2_return.thrift new file mode 100644 index 000000000..9719d1e40 --- /dev/null +++ b/compiler/cpp/test/keyword-samples/union2_return.thrift @@ -0,0 +1,3 @@ +union union_name { + 1: optional bool return=1 +} |