You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2021/12/19 18:46:29 UTC
[groovy] branch master updated: GROOVY-7500: add test case
This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new c6afd11 GROOVY-7500: add test case
c6afd11 is described below
commit c6afd119566cd40a1c4ff01ccdd473bd5cf46c26
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Sun Dec 19 12:46:23 2021 -0600
GROOVY-7500: add test case
---
.../groovy/transform/traitx/Groovy7500.groovy | 42 ++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/src/test/org/codehaus/groovy/transform/traitx/Groovy7500.groovy b/src/test/org/codehaus/groovy/transform/traitx/Groovy7500.groovy
new file mode 100644
index 0000000..923b6d3
--- /dev/null
+++ b/src/test/org/codehaus/groovy/transform/traitx/Groovy7500.groovy
@@ -0,0 +1,42 @@
+/*
+ * 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 org.codehaus.groovy.transform.traitx
+
+import org.junit.Test
+
+import static groovy.test.GroovyAssert.shouldFail
+
+final class Groovy7500 {
+
+ @Test
+ void testMetaClassOverride() {
+ shouldFail UnsupportedOperationException, '''
+ trait T {
+ def m() { 'T' }
+ }
+ class C implements T {
+ }
+
+ C.metaClass.m = { ->
+ throw new UnsupportedOperationException()
+ }
+ new C().m()
+ '''
+ }
+}