Copilot commented on code in PR #8405:
URL: https://github.com/apache/texera/pull/8405#discussion_r3933801533


##########
common/pybuilder/src/test/scala/org/apache/texera/amber/pybuilder/PythonTemplateBuilderSpec.scala:
##########
@@ -435,38 +509,79 @@ class PythonTemplateBuilderSpec extends AnyFunSuite {
   }
 
   test("all isBadNeighbor characters reject direct UI adjacency at compile 
time (left + right)") {
-    val candidates = (33 to 126).map(_.toChar) // printable ASCII, avoids 
whitespace
-    val badChars = candidates.filter(PythonLexerUtils.isBadNeighbor)
-
-    // This is intentionally exhaustive over the implementation-defined "bad 
neighbor" set.
-    // We assert only compile success/failure, not the specific error message.
-    badChars.zipWithIndex.foreach {
-      case (ch, i) =>
-        val esc = scalaUnicodeEscape(ch)
-
-        val leftAdj =
-          s"""
-           |import org.apache.texera.amber.pybuilder.PythonTemplateBuilder._
-           |import org.apache.texera.amber.pybuilder.PyStringTypes._
-           |object UiBadLeft_$i {
-           |  val ui: EncodableString = "x"
-           |  val b = pyb\"\"\"pre$esc${'$'}{ui}post\"\"\"
-           |}
-           |""".stripMargin
-
-        val rightAdj =
-          s"""
-           |import org.apache.texera.amber.pybuilder.PythonTemplateBuilder._
-           |import org.apache.texera.amber.pybuilder.PyStringTypes._
-           |object UiBadRight_$i {
-           |  val ui: EncodableString = "x"
-           |  val b = pyb\"\"\"pre${'$'}{ui}$esc post\"\"\"
-           |}
-           |""".stripMargin
-
-        assertToolboxDoesNotCompile(leftAdj)
-        assertToolboxDoesNotCompile(rightAdj)
+    assert(badNeighborChars.size == 65, "the sweep's character set changed 
unexpectedly")
+
+    val mismatches = List.newBuilder[String]
+    var checked = 0
+
+    badNeighborChars.foreach { ch =>
+      Seq(
+        ("left", leftAdjacentSnippet(ch), s"must not be immediately adjacent 
to '$ch' on the left"),
+        (
+          "right",
+          rightAdjacentSnippet(ch),
+          s"must not be immediately adjacent to '$ch' on the right"
+        )
+      ).foreach {
+        case (side, snippet, expectedReason) =>
+          checked += 1
+          val message = macroError(snippet)
+          if (!message.contains(boundaryMarker) || 
!message.contains(expectedReason)) {
+            mismatches += s"$side [$ch] (U+${"%04X".format(ch.toInt)}): 
${oneLine(message)}"
+          }
+      }
+    }
+
+    assert(checked == 130, "the sweep did not run every case")
+    val failures = mismatches.result()
+    assert(
+      failures.isEmpty,
+      s"${failures.size} of $checked adjacency cases did not abort with the 
neighbour reason:\n" +

Review Comment:
   Spelling is inconsistent with the rest of the codebase/tests (which 
predominantly use “neighbor”, e.g., isBadNeighbor / badLeftNeighbor). Consider 
switching this failure message to “neighbor” for consistency/searchability.
   
   This issue also appears in the following locations of the same file:
   - line 544
   - line 572
   - line 577



-- 
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