codeconsole commented on code in PR #16134:
URL: https://github.com/apache/grails-core/pull/16134#discussion_r3824200384


##########
grails-gsp/plugin/src/test/groovy/org/grails/web/taglib/ControllerTagCallRewriteSpec.groovy:
##########
@@ -0,0 +1,88 @@
+/*
+ *  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
+ *
+ *    https://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.grails.web.taglib
+
+import java.nio.file.Files
+import java.nio.file.Path
+
+import org.codehaus.groovy.control.CompilationUnit
+import org.codehaus.groovy.control.CompilerConfiguration
+import spock.lang.Specification
+import spock.lang.TempDir
+
+/**
+ * A controller can call tags too, through the tag library invoker trait 
rather than by being a tag
+ * library, so the same rewriting has to reach it.
+ *
+ * <p>Checked in the class file, because a rewritten call and a dynamic one 
produce the same output.
+ */
+class ControllerTagCallRewriteSpec extends Specification {
+
+    @TempDir
+    Path tempDir
+
+    void 'a class that can call tags has its tag calls compiled into 
invocations'() {
+        when: 'a class carrying the tag library invoker trait, as a controller 
does'
+        byte[] compiled = compile('''
+            import grails.artefact.gsp.TagLibraryInvoker
+            class TagCallingController implements TagLibraryInvoker {

Review Comment:
   Added back. It passes on macOS and Linux now.
   
   My reason for dropping it was wrong, worth correcting: I read the flakiness 
as the injector recognising a controller by its location turning on where the 
compilation happens. It does not — the `TagLibraryInvoker` assertion in that 
test holds on both platforms, so a controller compiled into a temporary 
`grails-app/controllers` is recognised fine. What varied was the rewrite, for 
the ordering reason above. Removing the test removed the signal rather than the 
flakiness.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to