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
75 lines (64 loc) · 2.4 KB
/
MarkdownParseTest.java
File metadata and controls
75 lines (64 loc) · 2.4 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import static org.junit.Assert.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import org.junit.*;
public class MarkdownParseTest {
/*
@Test
public void addition() {
assertEquals(2, 1 + 1);
}
@Test
public void testGetLinks(){
ArrayList<String> expected = new ArrayList<>();
assertEquals("Tests when there are no links", expected, MarkdownParse.getLinks("test2.md"));
ArrayList<String> expected2 = new ArrayList<>();
expected2.add("https://www.newlink.com");
expected2.add(" ");
try {
assertEquals("When there is one link and one ()[ ]",
expected2, MarkdownParse.getLinks(Files.readString(Path.of("test.md"))));
} catch (IOException e) {
e.printStackTrace();
}
}
@Test
public void getLinks1() throws IOException{
List<String> expect = List.of("https://something.com", "some-page.html");
Path fileName = Path.of("test-file.md");
String contents = Files.readString(fileName);
assertEquals(expect, MarkdownParse.getLinks(contents));
} */
@Test
public void getLinks8() throws IOException{
List<String> expect = List.of("`google.com","google.com","ucsd.edu");
Path fileName = Path.of("snippet-1.md");
String contents = Files.readString(fileName);
assertEquals(expect, MarkdownParse.getLinks(contents));
}
@Test
public void getLinks9() throws IOException{
List<String> expect = List.of("a.com","a.com(())","example.com");
Path fileName = Path.of("snippet-2.md");
String contents = Files.readString(fileName);
assertEquals(expect, MarkdownParse.getLinks(contents));
}
@Test
public void getLinks10() throws IOException{
List<String> expect = List.of("https://www.twitter.com","https://ucsd-cse15l-w22.github.io/","https://cse.ucsd.edu");
Path fileName = Path.of("snippet-1.md");
String contents = Files.readString(fileName);
assertEquals(expect, MarkdownParse.getLinks(contents));
}
/*
public void testPrint(){
ArrayList<String> expected2 = new ArrayList<>();
expected2.add("https://www.newlink.com");
expected2.add(" ");
assertPrint("[https://www.newlink.com, ]", System.out.println(expected2));
}
*/
}