File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed
src/test/java/dev/jbang/cli Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ ///usr/bin/env jbang "$0" "$@" ; exit $?
2
+ //DOCS readme.md
3
+
4
+ import static java .lang .System .*;
5
+
6
+ public class docstest1 {
7
+ public static void main (String ... args ) {
8
+ out .println ("Docs test 1" ));
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ ///usr/bin/env jbang "$0" "$@" ; exit $?
2
+ //DOCS https://www.jbang.dev/documentation/guide/latest/faq.html
3
+
4
+ import static java .lang .System .*;
5
+
6
+ public class docstest1 {
7
+ public static void main (String ... args ) {
8
+ out .println ("Docs test 2" ));
9
+ }
10
+ }
Original file line number Diff line number Diff line change 3
3
import static org .hamcrest .MatcherAssert .assertThat ;
4
4
import static org .hamcrest .Matchers .*;
5
5
6
+ import java .net .URI ;
6
7
import java .nio .file .Paths ;
7
8
import java .util .Collection ;
8
9
@@ -162,4 +163,22 @@ void testInfoStarSources() {
162
163
// assertThat(info.mainClass, equalTo("helloworld"));
163
164
assertThat (info .resolvedDependencies , empty ());
164
165
}
166
+
167
+ @ Test
168
+ void testInfoDocsFile () {
169
+ String src = examplesTestFolder .resolve ("docstest1.java" ).toString ();
170
+ CommandLine .ParseResult pr = JBang .getCommandLine ().parseArgs ("info" , "docs" , src );
171
+ Docs docs = (Docs ) pr .subcommand ().subcommand ().commandSpec ().userObject ();
172
+ URI uri = docs .getDocsUri ();
173
+ assertThat (uri .toString (), endsWith ("/itests/readme.md" ));
174
+ }
175
+
176
+ @ Test
177
+ void testInfoDocsUrl () {
178
+ String src = examplesTestFolder .resolve ("docstest2.java" ).toString ();
179
+ CommandLine .ParseResult pr = JBang .getCommandLine ().parseArgs ("info" , "docs" , src );
180
+ Docs docs = (Docs ) pr .subcommand ().subcommand ().commandSpec ().userObject ();
181
+ URI uri = docs .getDocsUri ();
182
+ assertThat (uri .toString (), equalTo ("https://www.jbang.dev/documentation/guide/latest/faq.html" ));
183
+ }
165
184
}
You can’t perform that action at this time.
0 commit comments