forked from cse15lss122/markdown-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMarkdownParseTest.java
More file actions
34 lines (28 loc) · 975 Bytes
/
MarkdownParseTest.java
File metadata and controls
34 lines (28 loc) · 975 Bytes
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
import static org.junit.Assert.*;
import org.junit.*;
public class MarkdownParseTest {
@Test
public void addition() {
assertEquals(2, 1 + 1);
}
@Test
public void testLinkAtBeginning() {
String contents= "[link title](a.com)";
List<String> expect = List.of("a.com");
assertEquals(MarkdownParse.getLinks(contents), expect);
}
@Test
public void testInfiniteLoop() { //failed and got stuck in infinite loop
String contents = ")[";
List<String> expect = new ArrayList<String>();
assertEquals(expect, MarkdownParse.getLinks(contents));
}
@Test
public void testRegular() {
String contents = "# Title [link1](https://something.com)[link2](some-thing.html)";
List<String> expect = new ArrayList<String>();
expect.add("https://something.com");
expect.add("some-thing.html");
assertEquals(expect, MarkdownParse.getLinks(contents));
}
}