File tree 3 files changed +23
-0
lines changed
src/test/java/dev/jbang/cli 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 4
4
//RUNTIME_OPTIONS -Dfoo=bar "-Dbar=aap noot mies"
5
5
//MANIFEST foo bar=baz baz=${bazprop:nada}
6
6
7
+ //DOCS readme.md
8
+
7
9
import static java .lang .System .*;
8
10
9
11
public class helloworld {
Original file line number Diff line number Diff line change 1
1
///usr/bin/env jbang "$0" "$@" ; exit $?
2
2
3
+ //DOCS https://www.jbang.dev/documentation/guide/latest/faq.html
4
+
3
5
System .out .println ("Hello " + (args .length >0 ?args [0 ]:"World" ));
4
6
5
7
/exit
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 ("helloworld.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 ("helloworld.jsh" ).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