You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2019/06/04 13:45:10 UTC

[GitHub] [maven-shared-utils] michael-o commented on a change in pull request #6: [MSHARED-822] MessageBuilder should support colored Paths

michael-o commented on a change in pull request #6: [MSHARED-822] MessageBuilder should support colored Paths
URL: https://github.com/apache/maven-shared-utils/pull/6#discussion_r290302637
 
 

 ##########
 File path: src/test/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilderTest.java
 ##########
 @@ -108,4 +113,52 @@ public void should_color_project_and_reset()
         assertThat( ansiMessageBuilder.toString(), equalTo( "\u001B[36ma project\u001B[m" ) );
     }
 
+    @Test
+    public void should_color_paths_and_reset()
+    {
+        String workingDir = Paths.get(("")).toAbsolutePath().toString();
+        MessageBuilder sut = new AnsiMessageBuilder( Ansi.ansi(), workingDir, workingDir );
+
+        sut.path( Paths.get( "file" ) );
+
+        assertThat( sut.toString(), containsString( "\u001B[0;34mfile\u001B[m" ));
+    }
+
+    @Test
+    public void should_color_working_dir_from_path()
+    {
+        Path absolutePath = Paths.get("src", "main").toAbsolutePath();
+        Path workingDir = Paths.get("").toAbsolutePath();
+        MessageBuilder sut = new AnsiMessageBuilder( Ansi.ansi(), workingDir.toString(), workingDir.toString() );
+
+        sut.path( absolutePath );
+
+        String expectedPath =  workingDir.toString() + File.separator;
+        assertThat(sut.toString(), containsString("\u001B[30m" + expectedPath + "\u001B[0;34m"));
+    }
+
+    @Test
+    public void should_color_module_dir_from_path()
+    {
+        Path filePath = Paths.get("core","src", "main").toAbsolutePath();
 
 Review comment:
   nitpick. space missing.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services