diff options
author | Yuxuan 'fishy' Wang <yuxuan.wang@reddit.com> | 2021-02-18 09:09:20 -0800 |
---|---|---|
committer | Yuxuan 'fishy' Wang <fishywang@gmail.com> | 2021-02-22 10:02:48 -0800 |
commit | b0b353191aeaa1b427d105892efa7facea6d4f1f (patch) | |
tree | 08a523fcec62a405eba32b7ef51068f85b35f90c /lib/go | |
parent | 6813b1914bf32b8d37d10207f10a092064ba36d7 (diff) | |
download | thrift-b0b353191aeaa1b427d105892efa7facea6d4f1f.tar.gz |
Move ConflictingNamesTest to lib/go/test
Client: go
Also add missing copyright header for files added in
https://github.com/apache/thrift/pull/2307.
Diffstat (limited to 'lib/go')
-rw-r--r-- | lib/go/test/ConflictArgNamesTest.thrift | 32 | ||||
-rw-r--r-- | lib/go/test/EqualsTest.thrift | 21 | ||||
-rw-r--r-- | lib/go/test/Makefile.am | 9 | ||||
-rw-r--r-- | lib/go/test/tests/conflict_arg_names_test.go | 27 | ||||
-rw-r--r-- | lib/go/test/tests/equals_test.go | 19 |
5 files changed, 105 insertions, 3 deletions
diff --git a/lib/go/test/ConflictArgNamesTest.thrift b/lib/go/test/ConflictArgNamesTest.thrift new file mode 100644 index 000000000..11323ecaf --- /dev/null +++ b/lib/go/test/ConflictArgNamesTest.thrift @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +service ConflictArgNamesTest { + /** + * Use some names that could conflict with the compiler code as args + * to make sure that the compiler handled them correctly. + */ + void testNameConflicts( + // 1: string args, // args is already a reserved keyword in thrift compiler + 2: string result, + 3: string meta, + 4: string r, + 5: string err, + ) +} diff --git a/lib/go/test/EqualsTest.thrift b/lib/go/test/EqualsTest.thrift index c699232b4..57ce131ec 100644 --- a/lib/go/test/EqualsTest.thrift +++ b/lib/go/test/EqualsTest.thrift @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + typedef i8 mybyte typedef string mystr typedef binary mybin @@ -106,4 +125,4 @@ struct MapEqualsFoo { 18: optional map<i64, mybyte> OptInt64MyByteMapFoo, 19: map<mybyte, i64> MyByteInt64MapFoo, 20: optional map<mybyte, i64> OptMyByteInt64MapFoo, -}
\ No newline at end of file +} diff --git a/lib/go/test/Makefile.am b/lib/go/test/Makefile.am index 2f748c6fa..4be652ed6 100644 --- a/lib/go/test/Makefile.am +++ b/lib/go/test/Makefile.am @@ -46,7 +46,9 @@ gopath: $(THRIFT) $(THRIFTTEST) \ ConflictNamespaceTestD.thrift \ ConflictNamespaceTestSuperThing.thrift \ ConflictNamespaceServiceTest.thrift \ - DuplicateImportsTest.thrift + DuplicateImportsTest.thrift \ + EqualsTest.thrift \ + ConflictArgNamesTest.thrift mkdir -p gopath/src grep -v list.*map.*list.*map $(THRIFTTEST) | grep -v 'set<Insanity>' > ThriftTest.thrift $(THRIFT) $(THRIFTARGS) -r IncludesTest.thrift @@ -74,6 +76,7 @@ gopath: $(THRIFT) $(THRIFTTEST) \ $(THRIFT) $(THRIFTARGS) ConflictNamespaceServiceTest.thrift $(THRIFT) $(THRIFTARGS) -r DuplicateImportsTest.thrift $(THRIFT) $(THRIFTARGS) EqualsTest.thrift + $(THRIFT) $(THRIFTARGS) ConflictArgNamesTest.thrift GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock || true sed -i 's/\"context\"/\"golang.org\/x\/net\/context\"/g' gopath/src/github.com/golang/mock/gomock/controller.go || true GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock @@ -99,7 +102,8 @@ check: gopath conflict/context/conflict_service-remote \ servicestest/container_test-remote \ duplicateimportstest \ - equalstest + equalstest \ + conflictargnamestest GOPATH=`pwd`/gopath $(GO) test thrift tests dontexportrwtest clean-local: @@ -113,6 +117,7 @@ EXTRA_DIST = \ tests \ common \ BinaryKeyTest.thrift \ + ConflictArgNamesTest.thrift \ ConflictNamespaceServiceTest.thrift \ ConflictNamespaceTestA.thrift \ ConflictNamespaceTestB.thrift \ diff --git a/lib/go/test/tests/conflict_arg_names_test.go b/lib/go/test/tests/conflict_arg_names_test.go new file mode 100644 index 000000000..92791517e --- /dev/null +++ b/lib/go/test/tests/conflict_arg_names_test.go @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package tests + +import ( + "conflictargnamestest" +) + +// We just want to make sure that the conflictargnamestest package compiles. +var _ = conflictargnamestest.GoUnusedProtection__ diff --git a/lib/go/test/tests/equals_test.go b/lib/go/test/tests/equals_test.go index 3489efa0d..deecb77ee 100644 --- a/lib/go/test/tests/equals_test.go +++ b/lib/go/test/tests/equals_test.go @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package tests import ( |