Skip to content

Commit bb8fec7

Browse files
committedFeb 22, 2021
Move ConflictingNamesTest to lib/go/test
Client: go Also add missing copyright header for files added in #2307.
1 parent abb8fa8 commit bb8fec7

6 files changed

+105
-17
lines changed
 
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
service ConflictArgNamesTest {
21+
/**
22+
* Use some names that could conflict with the compiler code as args
23+
* to make sure that the compiler handled them correctly.
24+
*/
25+
void testNameConflicts(
26+
// 1: string args, // args is already a reserved keyword in thrift compiler
27+
2: string result,
28+
3: string meta,
29+
4: string r,
30+
5: string err,
31+
)
32+
}

‎lib/go/test/EqualsTest.thrift

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
120
typedef i8 mybyte
221
typedef string mystr
322
typedef binary mybin
@@ -106,4 +125,4 @@ struct MapEqualsFoo {
106125
18: optional map<i64, mybyte> OptInt64MyByteMapFoo,
107126
19: map<mybyte, i64> MyByteInt64MapFoo,
108127
20: optional map<mybyte, i64> OptMyByteInt64MapFoo,
109-
}
128+
}

‎lib/go/test/Makefile.am

+7-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ gopath: $(THRIFT) $(THRIFTTEST) \
4646
ConflictNamespaceTestD.thrift \
4747
ConflictNamespaceTestSuperThing.thrift \
4848
ConflictNamespaceServiceTest.thrift \
49-
DuplicateImportsTest.thrift
49+
DuplicateImportsTest.thrift \
50+
EqualsTest.thrift \
51+
ConflictArgNamesTest.thrift
5052
mkdir -p gopath/src
5153
grep -v list.*map.*list.*map $(THRIFTTEST) | grep -v 'set<Insanity>' > ThriftTest.thrift
5254
$(THRIFT) $(THRIFTARGS) -r IncludesTest.thrift
@@ -74,6 +76,7 @@ gopath: $(THRIFT) $(THRIFTTEST) \
7476
$(THRIFT) $(THRIFTARGS) ConflictNamespaceServiceTest.thrift
7577
$(THRIFT) $(THRIFTARGS) -r DuplicateImportsTest.thrift
7678
$(THRIFT) $(THRIFTARGS) EqualsTest.thrift
79+
$(THRIFT) $(THRIFTARGS) ConflictArgNamesTest.thrift
7780
GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock || true
7881
sed -i 's/\"context\"/\"golang.org\/x\/net\/context\"/g' gopath/src/github.com/golang/mock/gomock/controller.go || true
7982
GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock
@@ -99,7 +102,8 @@ check: gopath
99102
conflict/context/conflict_service-remote \
100103
servicestest/container_test-remote \
101104
duplicateimportstest \
102-
equalstest
105+
equalstest \
106+
conflictargnamestest
103107
GOPATH=`pwd`/gopath $(GO) test thrift tests dontexportrwtest
104108

105109
clean-local:
@@ -113,6 +117,7 @@ EXTRA_DIST = \
113117
tests \
114118
common \
115119
BinaryKeyTest.thrift \
120+
ConflictArgNamesTest.thrift \
116121
ConflictNamespaceServiceTest.thrift \
117122
ConflictNamespaceTestA.thrift \
118123
ConflictNamespaceTestB.thrift \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package tests
21+
22+
import (
23+
"conflictargnamestest"
24+
)
25+
26+
// We just want to make sure that the conflictargnamestest package compiles.
27+
var _ = conflictargnamestest.GoUnusedProtection__

‎lib/go/test/tests/equals_test.go

+19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
120
package tests
221

322
import (

‎test/ThriftTest.thrift

-14
Original file line numberDiff line numberDiff line change
@@ -411,17 +411,3 @@ struct StructB {
411411
struct OptionalSetDefaultTest {
412412
1: optional set<string> with_default = [ "test" ]
413413
}
414-
415-
service ConflictingNamesTest {
416-
/**
417-
* Use some names that could conflict with the compiler code as args
418-
* to make sure that the compiler handled them correctly.
419-
*/
420-
void testNameConflicts(
421-
// 1: string args, // args is already a reserved keyword in thrift compiler
422-
// 2: string result, // result will cause problems in compiled netstd code
423-
3: string meta,
424-
4: string r,
425-
5: string err,
426-
)
427-
}

0 commit comments

Comments
 (0)
Please sign in to comment.