Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #374 from ldko/fix-371-integrity-attribute
Fix 371 integrity attribute
- Loading branch information
Showing
5 changed files
with
77 additions
and
0 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
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
59 changes: 59 additions & 0 deletions
59
...t/java/org/archive/wayback/replay/html/transformer/RegexReplaceStringTransformerTest.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,59 @@ | ||
/* | ||
* | ||
*/ | ||
package org.archive.wayback.replay.html.transformer; | ||
|
||
import java.net.URL; | ||
|
||
import junit.framework.TestCase; | ||
|
||
import org.archive.wayback.replay.html.transformer.JSStringTransformerTest.RecordingReplayParseContext; | ||
|
||
/** | ||
* unit test for {@link RegexReplaceStringTransformer}. | ||
* | ||
*/ | ||
public class RegexReplaceStringTransformerTest extends TestCase { | ||
|
||
URL baseURL; | ||
RecordingReplayParseContext rc; | ||
RegexReplaceStringTransformer st; | ||
|
||
/* (non-Javadoc) | ||
* @see junit.framework.TestCase#setUp() | ||
*/ | ||
protected void setUp() throws Exception { | ||
baseURL = new URL("http://foo.com"); | ||
rc = new RecordingReplayParseContext(null, baseURL, null); | ||
} | ||
|
||
public void testTransform() throws Exception { | ||
// values are input, regex to find, replacement for regex, expected result | ||
final String[][] cases = new String[][] { | ||
{ | ||
"sha256-1LpauPYMnfXHM+fTx8Rp/5Pca2TSsqj+uUr6j3fGYZM=", | ||
".*sha256.*", | ||
"", | ||
"", | ||
}, | ||
{ | ||
"examples/video/test.mp4", | ||
"video/[a-z]*.mp4", | ||
"video/changed.mp4", | ||
"examples/video/changed.mp4", | ||
}, | ||
{ | ||
"examples/video/test.mp4", | ||
"notmatching/[a-z]*.mp4", | ||
"video/changed.mp4", | ||
"examples/video/test.mp4", | ||
} | ||
}; | ||
|
||
for (String[] c : cases) { | ||
st = new RegexReplaceStringTransformer(c[1], c[2]); | ||
String result = st.transform(rc, c[0]); | ||
assertEquals(c[3], result); | ||
} | ||
} | ||
} |