forked from jenkinsci/ansicolor-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jenkinsci#185 Calculate hash based on line content. Test
- Loading branch information
Showing
3 changed files
with
44 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/test/java/hudson/plugins/ansicolor/action/LineIdentifierTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package hudson.plugins.ansicolor.action; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
public class LineIdentifierTest { | ||
|
||
private LineIdentifier lineIdentifier; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
lineIdentifier = new LineIdentifier(); | ||
} | ||
|
||
@Test | ||
public void canHashLine() { | ||
assertEquals("ojq32twB56Mha38FSpsOvwxZDdkOKa/SveGHDC4tgHY=", lineIdentifier.hash("test line 123", 735)); | ||
} | ||
|
||
@Test | ||
public void canDetermineIsEqualPositive() { | ||
assertTrue(lineIdentifier.isEqual("\u001B[92m\u001B[1mlightgreen bold \u001B[92m\u001B[22mlightgreen normal\u001B[0m", 67, "1mo5/lFK3s3+qaz1vK3o62k+EAJkd8Q0j3dMRH8Wkh4=")); | ||
} | ||
|
||
@Test | ||
public void canDetermineIsEqualNegative() { | ||
assertFalse(lineIdentifier.isEqual("\u001B[92m\u001B[1mlightgreen bold \u001B[92m\u001B[22mlightgreen normal\u001B[0m", 67, "bogus")); | ||
} | ||
} |