2012-03-16 17:14:37 -05:00
|
|
|
import result::result;
|
2012-02-26 18:32:57 -06:00
|
|
|
import std::getopts;
|
|
|
|
|
2012-02-29 21:06:50 -06:00
|
|
|
export output_format;
|
|
|
|
export output_style;
|
2012-02-26 18:32:57 -06:00
|
|
|
export config;
|
2012-02-29 20:10:40 -06:00
|
|
|
export default_config;
|
2012-02-26 18:32:57 -06:00
|
|
|
export parse_config;
|
2012-02-28 23:27:38 -06:00
|
|
|
export usage;
|
2012-07-06 21:06:58 -05:00
|
|
|
export markdown, pandoc_html;
|
|
|
|
export doc_per_crate, doc_per_mod;
|
2012-02-26 18:32:57 -06:00
|
|
|
|
2012-07-04 16:53:12 -05:00
|
|
|
/// The type of document to output
|
2012-02-26 18:32:57 -06:00
|
|
|
enum output_format {
|
2012-07-04 16:53:12 -05:00
|
|
|
/// Markdown
|
2012-02-26 18:32:57 -06:00
|
|
|
markdown,
|
2012-07-04 16:53:12 -05:00
|
|
|
/// HTML, via markdown and pandoc
|
2012-02-26 18:32:57 -06:00
|
|
|
pandoc_html
|
|
|
|
}
|
|
|
|
|
2012-07-04 16:53:12 -05:00
|
|
|
/// How to organize the output
|
2012-02-26 18:32:57 -06:00
|
|
|
enum output_style {
|
2012-07-04 16:53:12 -05:00
|
|
|
/// All in a single document
|
2012-02-26 18:32:57 -06:00
|
|
|
doc_per_crate,
|
2012-07-04 16:53:12 -05:00
|
|
|
/// Each module in its own document
|
2012-02-26 18:32:57 -06:00
|
|
|
doc_per_mod
|
|
|
|
}
|
|
|
|
|
2012-07-04 16:53:12 -05:00
|
|
|
/// The configuration for a rustdoc session
|
2012-02-26 18:32:57 -06:00
|
|
|
type config = {
|
2012-07-14 00:57:48 -05:00
|
|
|
input_crate: ~str,
|
|
|
|
output_dir: ~str,
|
2012-02-26 18:32:57 -06:00
|
|
|
output_format: output_format,
|
|
|
|
output_style: output_style,
|
2012-07-14 00:57:48 -05:00
|
|
|
pandoc_cmd: option<~str>
|
2012-02-26 18:32:57 -06:00
|
|
|
};
|
|
|
|
|
2012-07-14 00:57:48 -05:00
|
|
|
fn opt_output_dir() -> ~str { ~"output-dir" }
|
|
|
|
fn opt_output_format() -> ~str { ~"output-format" }
|
|
|
|
fn opt_output_style() -> ~str { ~"output-style" }
|
|
|
|
fn opt_pandoc_cmd() -> ~str { ~"pandoc-cmd" }
|
|
|
|
fn opt_help() -> ~str { ~"h" }
|
2012-02-26 18:32:57 -06:00
|
|
|
|
2012-07-14 00:57:48 -05:00
|
|
|
fn opts() -> ~[(getopts::opt, ~str)] {
|
2012-06-29 18:26:56 -05:00
|
|
|
~[
|
2012-02-26 18:32:57 -06:00
|
|
|
(getopts::optopt(opt_output_dir()),
|
2012-07-14 00:57:48 -05:00
|
|
|
~"--output-dir <val> put documents here"),
|
2012-02-26 18:32:57 -06:00
|
|
|
(getopts::optopt(opt_output_format()),
|
2012-07-14 00:57:48 -05:00
|
|
|
~"--output-format <val> either 'markdown' or 'html'"),
|
2012-02-26 18:32:57 -06:00
|
|
|
(getopts::optopt(opt_output_style()),
|
2012-07-14 00:57:48 -05:00
|
|
|
~"--output-style <val> either 'doc-per-crate' or 'doc-per-mod'"),
|
2012-02-26 18:32:57 -06:00
|
|
|
(getopts::optopt(opt_pandoc_cmd()),
|
2012-07-14 00:57:48 -05:00
|
|
|
~"--pandoc-cmd <val> the command for running pandoc"),
|
2012-02-28 23:27:38 -06:00
|
|
|
(getopts::optflag(opt_help()),
|
2012-07-14 00:57:48 -05:00
|
|
|
~"-h print help")
|
2012-06-29 18:26:56 -05:00
|
|
|
]
|
2012-02-26 18:32:57 -06:00
|
|
|
}
|
|
|
|
|
2012-02-28 23:27:38 -06:00
|
|
|
fn usage() {
|
2012-03-12 22:04:27 -05:00
|
|
|
import io::println;
|
2012-02-28 23:27:38 -06:00
|
|
|
|
2012-07-14 00:57:48 -05:00
|
|
|
println(~"Usage: rustdoc ~[options] <cratefile>\n");
|
|
|
|
println(~"Options:\n");
|
2012-06-30 18:19:07 -05:00
|
|
|
for opts().each |opt| {
|
2012-07-16 16:32:59 -05:00
|
|
|
println(#fmt(" %s", opt.second()));
|
2012-02-28 23:27:38 -06:00
|
|
|
}
|
2012-07-14 00:57:48 -05:00
|
|
|
println(~"");
|
2012-02-28 23:27:38 -06:00
|
|
|
}
|
|
|
|
|
2012-07-14 00:57:48 -05:00
|
|
|
fn default_config(input_crate: ~str) -> config {
|
2012-02-26 18:32:57 -06:00
|
|
|
{
|
|
|
|
input_crate: input_crate,
|
2012-07-14 00:57:48 -05:00
|
|
|
output_dir: ~".",
|
2012-02-26 18:32:57 -06:00
|
|
|
output_format: pandoc_html,
|
|
|
|
output_style: doc_per_mod,
|
|
|
|
pandoc_cmd: none
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-14 00:57:48 -05:00
|
|
|
type program_output = fn~(~str, ~[~str]) ->
|
|
|
|
{status: int, out: ~str, err: ~str};
|
2012-03-06 16:46:10 -06:00
|
|
|
|
2012-07-14 00:57:48 -05:00
|
|
|
fn mock_program_output(_prog: ~str, _args: ~[~str]) -> {
|
|
|
|
status: int, out: ~str, err: ~str
|
2012-03-06 16:46:10 -06:00
|
|
|
} {
|
|
|
|
{
|
|
|
|
status: 0,
|
2012-07-14 00:57:48 -05:00
|
|
|
out: ~"",
|
|
|
|
err: ~""
|
2012-03-06 16:46:10 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-14 00:57:48 -05:00
|
|
|
fn parse_config(args: ~[~str]) -> result<config, ~str> {
|
2012-03-12 22:04:27 -05:00
|
|
|
parse_config_(args, run::program_output)
|
2012-03-06 16:46:10 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn parse_config_(
|
2012-07-14 00:57:48 -05:00
|
|
|
args: ~[~str],
|
2012-03-06 16:46:10 -06:00
|
|
|
program_output: program_output
|
2012-07-14 00:57:48 -05:00
|
|
|
) -> result<config, ~str> {
|
2012-02-26 18:32:57 -06:00
|
|
|
let args = vec::tail(args);
|
2012-07-16 16:32:59 -05:00
|
|
|
let opts = vec::unzip(opts()).first();
|
2012-02-26 18:32:57 -06:00
|
|
|
alt getopts::getopts(args, opts) {
|
|
|
|
result::ok(match) {
|
|
|
|
if vec::len(match.free) == 1u {
|
|
|
|
let input_crate = vec::head(match.free);
|
2012-03-06 16:46:10 -06:00
|
|
|
config_from_opts(input_crate, match, program_output)
|
2012-02-26 18:32:57 -06:00
|
|
|
} else if vec::is_empty(match.free) {
|
2012-07-14 00:57:48 -05:00
|
|
|
result::err(~"no crates specified")
|
2012-02-26 18:32:57 -06:00
|
|
|
} else {
|
2012-07-14 00:57:48 -05:00
|
|
|
result::err(~"multiple crates specified")
|
2012-02-26 18:32:57 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
result::err(f) {
|
|
|
|
result::err(getopts::fail_str(f))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn config_from_opts(
|
2012-07-14 00:57:48 -05:00
|
|
|
input_crate: ~str,
|
2012-03-06 16:46:10 -06:00
|
|
|
match: getopts::match,
|
|
|
|
program_output: program_output
|
2012-07-14 00:57:48 -05:00
|
|
|
) -> result<config, ~str> {
|
2012-02-26 18:32:57 -06:00
|
|
|
|
|
|
|
let config = default_config(input_crate);
|
|
|
|
let result = result::ok(config);
|
2012-06-30 18:19:07 -05:00
|
|
|
let result = do result::chain(result) |config| {
|
2012-02-26 18:32:57 -06:00
|
|
|
let output_dir = getopts::opt_maybe_str(match, opt_output_dir());
|
|
|
|
result::ok({
|
2012-04-11 11:24:46 -05:00
|
|
|
output_dir: option::get_default(output_dir, config.output_dir)
|
2012-02-26 18:32:57 -06:00
|
|
|
with config
|
|
|
|
})
|
|
|
|
};
|
2012-06-30 18:19:07 -05:00
|
|
|
let result = do result::chain(result) |config| {
|
2012-02-26 18:32:57 -06:00
|
|
|
let output_format = getopts::opt_maybe_str(
|
|
|
|
match, opt_output_format());
|
2012-06-26 15:55:56 -05:00
|
|
|
do option::map_default(output_format, result::ok(config))
|
2012-06-30 18:19:07 -05:00
|
|
|
|output_format| {
|
2012-06-26 15:55:56 -05:00
|
|
|
do result::chain(parse_output_format(output_format))
|
2012-06-30 18:19:07 -05:00
|
|
|
|output_format| {
|
2012-06-26 15:55:56 -05:00
|
|
|
|
2012-02-26 18:32:57 -06:00
|
|
|
result::ok({
|
|
|
|
output_format: output_format
|
|
|
|
with config
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2012-06-30 18:19:07 -05:00
|
|
|
let result = do result::chain(result) |config| {
|
2012-02-26 18:32:57 -06:00
|
|
|
let output_style = getopts::opt_maybe_str(match, opt_output_style());
|
2012-06-26 15:55:56 -05:00
|
|
|
do option::map_default(output_style, result::ok(config))
|
2012-06-30 18:19:07 -05:00
|
|
|
|output_style| {
|
|
|
|
do result::chain(parse_output_style(output_style))
|
|
|
|
|output_style| {
|
2012-02-26 18:32:57 -06:00
|
|
|
result::ok({
|
|
|
|
output_style: output_style
|
|
|
|
with config
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2012-06-30 18:19:07 -05:00
|
|
|
let result = do result::chain(result) |config| {
|
2012-02-26 18:32:57 -06:00
|
|
|
let pandoc_cmd = getopts::opt_maybe_str(match, opt_pandoc_cmd());
|
2012-03-06 16:46:10 -06:00
|
|
|
let pandoc_cmd = maybe_find_pandoc(
|
|
|
|
config, pandoc_cmd, program_output);
|
2012-06-30 18:19:07 -05:00
|
|
|
do result::chain(pandoc_cmd) |pandoc_cmd| {
|
2012-02-26 18:32:57 -06:00
|
|
|
result::ok({
|
|
|
|
pandoc_cmd: pandoc_cmd
|
|
|
|
with config
|
|
|
|
})
|
|
|
|
}
|
|
|
|
};
|
|
|
|
ret result;
|
|
|
|
}
|
|
|
|
|
2012-07-14 00:57:48 -05:00
|
|
|
fn parse_output_format(output_format: ~str) -> result<output_format, ~str> {
|
2012-02-26 18:32:57 -06:00
|
|
|
alt output_format {
|
2012-07-14 00:57:48 -05:00
|
|
|
~"markdown" { result::ok(markdown) }
|
|
|
|
~"html" { result::ok(pandoc_html) }
|
2012-02-26 18:32:57 -06:00
|
|
|
_ { result::err(#fmt("unknown output format '%s'", output_format)) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-14 00:57:48 -05:00
|
|
|
fn parse_output_style(output_style: ~str) -> result<output_style, ~str> {
|
2012-02-26 18:32:57 -06:00
|
|
|
alt output_style {
|
2012-07-14 00:57:48 -05:00
|
|
|
~"doc-per-crate" { result::ok(doc_per_crate) }
|
|
|
|
~"doc-per-mod" { result::ok(doc_per_mod) }
|
2012-02-26 18:32:57 -06:00
|
|
|
_ { result::err(#fmt("unknown output style '%s'", output_style)) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn maybe_find_pandoc(
|
2012-03-06 16:46:10 -06:00
|
|
|
config: config,
|
2012-07-14 00:57:48 -05:00
|
|
|
maybe_pandoc_cmd: option<~str>,
|
2012-03-06 16:46:10 -06:00
|
|
|
program_output: program_output
|
2012-07-14 00:57:48 -05:00
|
|
|
) -> result<option<~str>, ~str> {
|
2012-03-06 16:46:10 -06:00
|
|
|
if config.output_format != pandoc_html {
|
|
|
|
ret result::ok(maybe_pandoc_cmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
let possible_pandocs = alt maybe_pandoc_cmd {
|
2012-06-29 18:26:56 -05:00
|
|
|
some(pandoc_cmd) { ~[pandoc_cmd] }
|
2012-03-06 16:46:10 -06:00
|
|
|
none {
|
2012-07-14 00:57:48 -05:00
|
|
|
~[~"pandoc"] + alt os::homedir() {
|
2012-03-07 21:22:02 -06:00
|
|
|
some(dir) {
|
2012-07-14 00:57:48 -05:00
|
|
|
~[path::connect(dir, ~".cabal/bin/pandoc")]
|
2012-03-07 21:22:02 -06:00
|
|
|
}
|
2012-06-29 18:26:56 -05:00
|
|
|
none { ~[] }
|
2012-03-07 21:22:02 -06:00
|
|
|
}
|
2012-03-06 16:46:10 -06:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-06-30 18:19:07 -05:00
|
|
|
let pandoc = do vec::find(possible_pandocs) |pandoc| {
|
2012-07-14 00:57:48 -05:00
|
|
|
let output = program_output(pandoc, ~[~"--version"]);
|
2012-03-06 16:46:10 -06:00
|
|
|
#debug("testing pandoc cmd %s: %?", pandoc, output);
|
|
|
|
output.status == 0
|
|
|
|
};
|
|
|
|
|
|
|
|
if option::is_some(pandoc) {
|
|
|
|
result::ok(pandoc)
|
|
|
|
} else {
|
2012-07-14 00:57:48 -05:00
|
|
|
result::err(~"couldn't find pandoc")
|
2012-03-06 16:46:10 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_find_pandoc() {
|
|
|
|
let config = {
|
|
|
|
output_format: pandoc_html
|
2012-07-14 00:57:48 -05:00
|
|
|
with default_config(~"test")
|
2012-03-06 16:46:10 -06:00
|
|
|
};
|
2012-07-14 00:57:48 -05:00
|
|
|
let mock_program_output = fn~(_prog: ~str, _args: ~[~str]) -> {
|
|
|
|
status: int, out: ~str, err: ~str
|
2012-03-06 16:46:10 -06:00
|
|
|
} {
|
|
|
|
{
|
2012-07-14 00:57:48 -05:00
|
|
|
status: 0, out: ~"pandoc 1.8.2.1", err: ~""
|
2012-03-06 16:46:10 -06:00
|
|
|
}
|
|
|
|
};
|
|
|
|
let result = maybe_find_pandoc(config, none, mock_program_output);
|
2012-07-14 00:57:48 -05:00
|
|
|
assert result == result::ok(some(~"pandoc"));
|
2012-03-06 16:46:10 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_error_with_no_pandoc() {
|
|
|
|
let config = {
|
|
|
|
output_format: pandoc_html
|
2012-07-14 00:57:48 -05:00
|
|
|
with default_config(~"test")
|
2012-03-06 16:46:10 -06:00
|
|
|
};
|
2012-07-14 00:57:48 -05:00
|
|
|
let mock_program_output = fn~(_prog: ~str, _args: ~[~str]) -> {
|
|
|
|
status: int, out: ~str, err: ~str
|
2012-03-06 16:46:10 -06:00
|
|
|
} {
|
|
|
|
{
|
2012-07-14 00:57:48 -05:00
|
|
|
status: 1, out: ~"", err: ~""
|
2012-03-06 16:46:10 -06:00
|
|
|
}
|
|
|
|
};
|
|
|
|
let result = maybe_find_pandoc(config, none, mock_program_output);
|
2012-07-14 00:57:48 -05:00
|
|
|
assert result == result::err(~"couldn't find pandoc");
|
2012-03-06 16:46:10 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod test {
|
2012-07-14 00:57:48 -05:00
|
|
|
fn parse_config(args: ~[~str]) -> result<config, ~str> {
|
2012-03-06 16:46:10 -06:00
|
|
|
parse_config_(args, mock_program_output)
|
2012-02-26 18:32:57 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_error_with_no_crates() {
|
2012-07-14 00:57:48 -05:00
|
|
|
let config = test::parse_config(~[~"rustdoc"]);
|
|
|
|
assert result::get_err(config) == ~"no crates specified";
|
2012-02-26 18:32:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_error_with_multiple_crates() {
|
2012-06-25 22:00:46 -05:00
|
|
|
let config =
|
2012-07-14 00:57:48 -05:00
|
|
|
test::parse_config(~[~"rustdoc", ~"crate1.rc", ~"crate2.rc"]);
|
|
|
|
assert result::get_err(config) == ~"multiple crates specified";
|
2012-02-26 18:32:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_set_output_dir_to_cwd_if_not_provided() {
|
2012-07-14 00:57:48 -05:00
|
|
|
let config = test::parse_config(~[~"rustdoc", ~"crate.rc"]);
|
|
|
|
assert result::get(config).output_dir == ~".";
|
2012-02-26 18:32:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_set_output_dir_if_provided() {
|
2012-06-29 18:26:56 -05:00
|
|
|
let config = test::parse_config(~[
|
2012-07-14 00:57:48 -05:00
|
|
|
~"rustdoc", ~"crate.rc", ~"--output-dir", ~"snuggles"
|
2012-06-29 18:26:56 -05:00
|
|
|
]);
|
2012-07-14 00:57:48 -05:00
|
|
|
assert result::get(config).output_dir == ~"snuggles";
|
2012-02-26 18:32:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_set_output_format_to_pandoc_html_if_not_provided() {
|
2012-07-14 00:57:48 -05:00
|
|
|
let config = test::parse_config(~[~"rustdoc", ~"crate.rc"]);
|
2012-02-26 18:32:57 -06:00
|
|
|
assert result::get(config).output_format == pandoc_html;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_set_output_format_to_markdown_if_requested() {
|
2012-06-29 18:26:56 -05:00
|
|
|
let config = test::parse_config(~[
|
2012-07-14 00:57:48 -05:00
|
|
|
~"rustdoc", ~"crate.rc", ~"--output-format", ~"markdown"
|
2012-06-29 18:26:56 -05:00
|
|
|
]);
|
2012-02-26 18:32:57 -06:00
|
|
|
assert result::get(config).output_format == markdown;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_set_output_format_to_pandoc_html_if_requested() {
|
2012-06-29 18:26:56 -05:00
|
|
|
let config = test::parse_config(~[
|
2012-07-14 00:57:48 -05:00
|
|
|
~"rustdoc", ~"crate.rc", ~"--output-format", ~"html"
|
2012-06-29 18:26:56 -05:00
|
|
|
]);
|
2012-02-26 18:32:57 -06:00
|
|
|
assert result::get(config).output_format == pandoc_html;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_error_on_bogus_format() {
|
2012-06-29 18:26:56 -05:00
|
|
|
let config = test::parse_config(~[
|
2012-07-14 00:57:48 -05:00
|
|
|
~"rustdoc", ~"crate.rc", ~"--output-format", ~"bogus"
|
2012-06-29 18:26:56 -05:00
|
|
|
]);
|
2012-07-14 00:57:48 -05:00
|
|
|
assert result::get_err(config) == ~"unknown output format 'bogus'";
|
2012-02-26 18:32:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_set_output_style_to_doc_per_mod_by_default() {
|
2012-07-14 00:57:48 -05:00
|
|
|
let config = test::parse_config(~[~"rustdoc", ~"crate.rc"]);
|
2012-02-26 18:32:57 -06:00
|
|
|
assert result::get(config).output_style == doc_per_mod;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_set_output_style_to_one_doc_if_requested() {
|
2012-06-29 18:26:56 -05:00
|
|
|
let config = test::parse_config(~[
|
2012-07-14 00:57:48 -05:00
|
|
|
~"rustdoc", ~"crate.rc", ~"--output-style", ~"doc-per-crate"
|
2012-06-29 18:26:56 -05:00
|
|
|
]);
|
2012-02-26 18:32:57 -06:00
|
|
|
assert result::get(config).output_style == doc_per_crate;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_set_output_style_to_doc_per_mod_if_requested() {
|
2012-06-29 18:26:56 -05:00
|
|
|
let config = test::parse_config(~[
|
2012-07-14 00:57:48 -05:00
|
|
|
~"rustdoc", ~"crate.rc", ~"--output-style", ~"doc-per-mod"
|
2012-06-29 18:26:56 -05:00
|
|
|
]);
|
2012-02-26 18:32:57 -06:00
|
|
|
assert result::get(config).output_style == doc_per_mod;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_error_on_bogus_output_style() {
|
2012-06-29 18:26:56 -05:00
|
|
|
let config = test::parse_config(~[
|
2012-07-14 00:57:48 -05:00
|
|
|
~"rustdoc", ~"crate.rc", ~"--output-style", ~"bogus"
|
2012-06-29 18:26:56 -05:00
|
|
|
]);
|
2012-07-14 00:57:48 -05:00
|
|
|
assert result::get_err(config) == ~"unknown output style 'bogus'";
|
2012-02-26 18:32:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_set_pandoc_command_if_requested() {
|
2012-06-29 18:26:56 -05:00
|
|
|
let config = test::parse_config(~[
|
2012-07-14 00:57:48 -05:00
|
|
|
~"rustdoc", ~"crate.rc", ~"--pandoc-cmd", ~"panda-bear-doc"
|
2012-06-29 18:26:56 -05:00
|
|
|
]);
|
2012-07-14 00:57:48 -05:00
|
|
|
assert result::get(config).pandoc_cmd == some(~"panda-bear-doc");
|
2012-02-26 18:32:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn should_set_pandoc_command_when_using_pandoc() {
|
2012-07-14 00:57:48 -05:00
|
|
|
let config = test::parse_config(~[~"rustdoc", ~"crate.rc"]);
|
|
|
|
assert result::get(config).pandoc_cmd == some(~"pandoc");
|
2012-06-25 22:00:46 -05:00
|
|
|
}
|