Test that symbol # is allowed in the file/directory name

The fix itself was accidentally already committed in the previous pr.

Closes #10766.

PiperOrigin-RevId: 294668120
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/ninja/lexer/NinjaLexerStep.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/ninja/lexer/NinjaLexerStep.java
index 650d0a4..7ce48d1 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/ninja/lexer/NinjaLexerStep.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/ninja/lexer/NinjaLexerStep.java
@@ -47,6 +47,7 @@
   private static final ImmutableSortedSet<Byte> IDENTIFIER_SYMBOLS =
       createByteSet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-");
   private static final ImmutableSortedSet<Byte> TEXT_STOPPERS = createByteSet("\n\r \t#$:\u0000");
+  // We allow # symbol in the path, so the comment on the line with path can only start with space.
   private static final ImmutableSortedSet<Byte> PATH_STOPPERS = createByteSet("\n\r \t$:|\u0000");
 
   private static ImmutableSortedSet<Byte> createByteSet(String variants) {
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/rules/ninja/NinjaLexerStepTest.java b/src/test/java/com/google/devtools/build/lib/bazel/rules/ninja/NinjaLexerStepTest.java
index 9d88fe0..7f007f1 100644
--- a/src/test/java/com/google/devtools/build/lib/bazel/rules/ninja/NinjaLexerStepTest.java
+++ b/src/test/java/com/google/devtools/build/lib/bazel/rules/ninja/NinjaLexerStepTest.java
@@ -145,6 +145,17 @@
   }
 
   @Test
+  public void testReadPath() {
+    doTest(
+        "this/is/the/relative/path.txt",
+        NinjaLexerStep::readPath,
+        "this/is/the/relative/path.txt",
+        false);
+    doTest(
+        "relative/text#.properties", NinjaLexerStep::readPath, "relative/text#.properties", false);
+  }
+
+  @Test
   public void testTryReadDoublePipe() {
     doTest("||", NinjaLexerStep::tryReadDoublePipe);
   }