forked from ucsd-cse15l-w22/markdown-parse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMarkdownParseTest.java
More file actions
60 lines (54 loc) · 2.09 KB
/
MarkdownParseTest.java
File metadata and controls
60 lines (54 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import static org.junit.Assert.*;
import java.io.IOException;
import org.junit.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
public class MarkdownParseTest {
@Test
public void addition() {
assertEquals(2, 1 + 1);
}
@Test
public void testFile() throws IOException{
Path filename = Path.of("test-file.md");
String contents = Files.readString(filename);
assertEquals(List.of("https://something.com", "some-page.html"),MarkdownParse.getLinks(contents));
}
@Test
public void break1() throws IOException{
Path filename = Path.of("break1.md");
String contents = Files.readString(filename);
assertEquals(List.of("https://something.com", "some-page.html"),MarkdownParse.getLinks(contents));
}
@Test
public void break2() throws IOException{
Path filename = Path.of("break2.md");
String contents = Files.readString(filename);
assertEquals(List.of("https://something().com"),MarkdownParse.getLinks(contents));
}
@Test
public void break3() throws IOException{
Path filename = Path.of("break3.md");
String contents = Files.readString(filename);
assertEquals(List.of(),MarkdownParse.getLinks(contents));
}
@Test
public void Snippet1() throws IOException{
Path filename = Path.of("Snippet1.md");
String contents = Files.readString(filename);
assertEquals(List.of("google.com", "google.com", "ucsd.edu"), MarkdownParse.getLinks(contents));
}
@Test
public void Snippet2() throws IOException{
Path filename = Path.of("Snippet2.md");
String contents = Files.readString(filename);
assertEquals(List.of("a.com(())", "example.com"), MarkdownParse.getLinks(contents));
}
@Test
public void Snippet3() throws IOException{
Path filename = Path.of("Snippet3.md");
String contents = Files.readString(filename);
assertEquals(List.of("https://www.twitter.com", "https://ucsd-cse15l-w22.github.io/", "https://cse.ucsd.edu/"), MarkdownParse.getLinks(contents));
}
}