-
Notifications
You must be signed in to change notification settings - Fork 82
/
SnippetDocsDemo.java
129 lines (104 loc) · 2.92 KB
/
SnippetDocsDemo.java
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package dev.nipafx.demo.java18.javadoc;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.util.List;
class SnippetDocsDemo {
@Test
void constructorDemo() {
// @start region="constructor"
// How to call the parameterless constructor:
SnippetDocs docs = new SnippetDocs();
// @end
// assert correct behavior...
}
@Nested
class HighlightDemo {
@Test
void substringDemo() {
// @start region="highlight-substring"
// it's similar to `new Object()`:
SnippetDocs docs = new SnippetDocs(); // @highlight substring="new SnippetDocs()"
// @end
}
@Test
void regexDemo() {
// @start region="highlight-regex"
// it's similar to `new Object()`:
SnippetDocs docs = new SnippetDocs(); // @highlight regex="SnippetDocs[^\s]*"
// @end
}
@Test
void singleDemo() {
// @start region="highlight-single"
// it's similar to `new Object()`:
SnippetDocs docs = new SnippetDocs(); // @highlight substring="new"
// @end
}
@Test
void regionDemo() {
// @start region="highlight-region" @highlight region substring="new"
// it's similar to `new Object()`:
SnippetDocs docs = new SnippetDocs();
// @end @end
}
@Test
void boldDemo() {
// @start region="highlight-bold"
// it's similar to `new Object()`:
SnippetDocs docs = new SnippetDocs(); // @highlight substring="new SnippetDocs()" type="bold"
// @end
}
@Test
void italicDemo() {
// @start region="highlight-italic"
// it's similar to `new Object()`:
SnippetDocs docs = new SnippetDocs(); // @highlight substring="new SnippetDocs()" type="italic"
// @end
}
@Test
void highlightedDemo() {
// @start region="highlight-highlighted"
// it's similar to `new Object()`:
SnippetDocs docs = new SnippetDocs(); // @highlight substring="new SnippetDocs()" type="highlight"
// @end
}
@Test
void customHighlightedDemo() {
// @start region="highlight-scary"
// styled with src/demo/css/javadoc-highlight.css
SnippetDocs docs = new SnippetDocs(); // @highlight substring="new SnippetDocs()" type="scary"
// @end
}
}
@Nested
class ReplaceDemo {
@Test
void substringDemo() {
// @start region="replace-substring"
// it's similar to `new Object()`:
SnippetDocs docs = new SnippetDocs(); // @replace substring="SnippetDocs docs" replacement="..."
// @end
}
}
@Nested
class LinkDemo {
@Test
void regexDemo() {
// @start region="link-regex" @link region regex="new Object\(\)" target="Object#Object()"
// it's similar to `new Object()`:
SnippetDocs docs = new SnippetDocs();
// @end @end
}
}
@Nested
class InlineCheckDemo {
@Test
void demo() {
// for hybrid snippets (inline and an external file), the @start comment needs to end with
// a semicolon or the snippet starts with a spurious newline
// @start region="inline-check":
List<String> yay = List.of("Don't", "have to", "escape <>&", "!");
// @end
}
}
}