From 44eba83044edcda18ef487550bb564a4d6ef8829 Mon Sep 17 00:00:00 2001 From: Ivan Veselov Date: Wed, 19 Jun 2019 20:39:42 +0100 Subject: [PATCH 1/2] Use trybuild for testing expected proc macro errors --- Cargo.toml | 3 ++ tests/macro-errors.rs | 12 +++++++ tests/ui/bool_default_value.rs | 23 ++++++++++++ tests/ui/bool_default_value.stderr | 7 ++++ tests/ui/bool_required.rs | 23 ++++++++++++ tests/ui/bool_required.stderr | 7 ++++ tests/ui/flatten_and_doc.rs | 32 +++++++++++++++++ tests/ui/flatten_and_doc.stderr | 7 ++++ tests/ui/flatten_and_methods.rs | 31 ++++++++++++++++ tests/ui/flatten_and_methods.stderr | 7 ++++ tests/ui/flatten_and_parse.rs | 31 ++++++++++++++++ tests/ui/flatten_and_parse.stderr | 7 ++++ tests/ui/literal_list_element.rs | 24 +++++++++++++ tests/ui/literal_list_element.stderr | 7 ++++ tests/ui/non_existent_attr.rs | 23 ++++++++++++ tests/ui/non_existent_attr.stderr | 7 ++++ tests/ui/non_literal_attr_value.rs | 24 +++++++++++++ tests/ui/non_literal_attr_value.stderr | 7 ++++ tests/ui/opt_opt_nonpositional.rs | 22 ++++++++++++ tests/ui/opt_opt_nonpositional.stderr | 7 ++++ tests/ui/opt_vec_nonpositional.rs | 22 ++++++++++++ tests/ui/opt_vec_nonpositional.stderr | 7 ++++ tests/ui/option_default_value.rs | 23 ++++++++++++ tests/ui/option_default_value.stderr | 7 ++++ tests/ui/option_required.rs | 23 ++++++++++++ tests/ui/option_required.stderr | 7 ++++ tests/ui/parse_empty_try_from_os.rs | 23 ++++++++++++ tests/ui/parse_empty_try_from_os.stderr | 7 ++++ tests/ui/parse_function_is_not_path.rs | 23 ++++++++++++ tests/ui/parse_function_is_not_path.stderr | 7 ++++ tests/ui/parse_literal_spec.rs | 23 ++++++++++++ tests/ui/parse_literal_spec.stderr | 7 ++++ tests/ui/parse_not_zero_args.rs | 23 ++++++++++++ tests/ui/parse_not_zero_args.stderr | 7 ++++ tests/ui/raw_wrong_entry.rs | 23 ++++++++++++ tests/ui/raw_wrong_entry.stderr | 7 ++++ tests/ui/rename_all_wrong_casing.rs | 23 ++++++++++++ tests/ui/rename_all_wrong_casing.stderr | 7 ++++ tests/ui/struct_flatten.rs | 23 ++++++++++++ tests/ui/struct_flatten.stderr | 7 ++++ tests/ui/struct_parse.rs | 23 ++++++++++++ tests/ui/struct_parse.stderr | 7 ++++ tests/ui/struct_subcommand.rs | 23 ++++++++++++ tests/ui/struct_subcommand.stderr | 7 ++++ tests/ui/structopt_empty_attr.rs | 24 +++++++++++++ tests/ui/structopt_empty_attr.stderr | 7 ++++ tests/ui/structopt_name_value_attr.rs | 24 +++++++++++++ tests/ui/structopt_name_value_attr.stderr | 7 ++++ tests/ui/subcommand_and_flatten.rs | 38 ++++++++++++++++++++ tests/ui/subcommand_and_flatten.stderr | 7 ++++ tests/ui/subcommand_and_methods.rs | 38 ++++++++++++++++++++ tests/ui/subcommand_and_methods.stderr | 7 ++++ tests/ui/subcommand_and_parse.rs | 38 ++++++++++++++++++++ tests/ui/subcommand_and_parse.stderr | 7 ++++ tests/ui/subcommand_opt_opt.rs | 38 ++++++++++++++++++++ tests/ui/subcommand_opt_opt.stderr | 7 ++++ tests/ui/subcommand_opt_vec.rs | 38 ++++++++++++++++++++ tests/ui/subcommand_opt_vec.stderr | 7 ++++ tests/ui/tuple_enum.stderr | 42 ++++++++++++++++++++++ tests/ui/tuple_struct.rs | 20 +++++++++++ tests/ui/tuple_struct.stderr | 7 ++++ 61 files changed, 1026 insertions(+) create mode 100644 tests/macro-errors.rs create mode 100644 tests/ui/bool_default_value.rs create mode 100644 tests/ui/bool_default_value.stderr create mode 100644 tests/ui/bool_required.rs create mode 100644 tests/ui/bool_required.stderr create mode 100644 tests/ui/flatten_and_doc.rs create mode 100644 tests/ui/flatten_and_doc.stderr create mode 100644 tests/ui/flatten_and_methods.rs create mode 100644 tests/ui/flatten_and_methods.stderr create mode 100644 tests/ui/flatten_and_parse.rs create mode 100644 tests/ui/flatten_and_parse.stderr create mode 100644 tests/ui/literal_list_element.rs create mode 100644 tests/ui/literal_list_element.stderr create mode 100644 tests/ui/non_existent_attr.rs create mode 100644 tests/ui/non_existent_attr.stderr create mode 100644 tests/ui/non_literal_attr_value.rs create mode 100644 tests/ui/non_literal_attr_value.stderr create mode 100644 tests/ui/opt_opt_nonpositional.rs create mode 100644 tests/ui/opt_opt_nonpositional.stderr create mode 100644 tests/ui/opt_vec_nonpositional.rs create mode 100644 tests/ui/opt_vec_nonpositional.stderr create mode 100644 tests/ui/option_default_value.rs create mode 100644 tests/ui/option_default_value.stderr create mode 100644 tests/ui/option_required.rs create mode 100644 tests/ui/option_required.stderr create mode 100644 tests/ui/parse_empty_try_from_os.rs create mode 100644 tests/ui/parse_empty_try_from_os.stderr create mode 100644 tests/ui/parse_function_is_not_path.rs create mode 100644 tests/ui/parse_function_is_not_path.stderr create mode 100644 tests/ui/parse_literal_spec.rs create mode 100644 tests/ui/parse_literal_spec.stderr create mode 100644 tests/ui/parse_not_zero_args.rs create mode 100644 tests/ui/parse_not_zero_args.stderr create mode 100644 tests/ui/raw_wrong_entry.rs create mode 100644 tests/ui/raw_wrong_entry.stderr create mode 100644 tests/ui/rename_all_wrong_casing.rs create mode 100644 tests/ui/rename_all_wrong_casing.stderr create mode 100644 tests/ui/struct_flatten.rs create mode 100644 tests/ui/struct_flatten.stderr create mode 100644 tests/ui/struct_parse.rs create mode 100644 tests/ui/struct_parse.stderr create mode 100644 tests/ui/struct_subcommand.rs create mode 100644 tests/ui/struct_subcommand.stderr create mode 100644 tests/ui/structopt_empty_attr.rs create mode 100644 tests/ui/structopt_empty_attr.stderr create mode 100644 tests/ui/structopt_name_value_attr.rs create mode 100644 tests/ui/structopt_name_value_attr.stderr create mode 100644 tests/ui/subcommand_and_flatten.rs create mode 100644 tests/ui/subcommand_and_flatten.stderr create mode 100644 tests/ui/subcommand_and_methods.rs create mode 100644 tests/ui/subcommand_and_methods.stderr create mode 100644 tests/ui/subcommand_and_parse.rs create mode 100644 tests/ui/subcommand_and_parse.stderr create mode 100644 tests/ui/subcommand_opt_opt.rs create mode 100644 tests/ui/subcommand_opt_opt.stderr create mode 100644 tests/ui/subcommand_opt_vec.rs create mode 100644 tests/ui/subcommand_opt_vec.stderr create mode 100644 tests/ui/tuple_enum.stderr create mode 100644 tests/ui/tuple_struct.rs create mode 100644 tests/ui/tuple_struct.stderr diff --git a/Cargo.toml b/Cargo.toml index 5ad45319..9b1630ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,4 +30,7 @@ travis-ci = { repository = "TeXitoi/structopt" } clap = { version = "2.33", default-features = false } structopt-derive = { path = "structopt-derive", version = "0.3.0" } +[dev-dependencies] +trybuild = "1.0.5" + [workspace] diff --git a/tests/macro-errors.rs b/tests/macro-errors.rs new file mode 100644 index 00000000..c82a5602 --- /dev/null +++ b/tests/macro-errors.rs @@ -0,0 +1,12 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed + +#[test] +fn ui() { + let t = trybuild::TestCases::new(); + t.compile_fail("tests/ui/*.rs"); +} diff --git a/tests/ui/bool_default_value.rs b/tests/ui/bool_default_value.rs new file mode 100644 index 00000000..8caf379a --- /dev/null +++ b/tests/ui/bool_default_value.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt(short, default_value = true)] + b: bool, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/bool_default_value.stderr b/tests/ui/bool_default_value.stderr new file mode 100644 index 00000000..9c18c995 --- /dev/null +++ b/tests/ui/bool_default_value.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/bool_default_value.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: default_value is meaningless for bool diff --git a/tests/ui/bool_required.rs b/tests/ui/bool_required.rs new file mode 100644 index 00000000..bcf8df00 --- /dev/null +++ b/tests/ui/bool_required.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt(short, required = true)] + b: bool, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/bool_required.stderr b/tests/ui/bool_required.stderr new file mode 100644 index 00000000..c48e3ddf --- /dev/null +++ b/tests/ui/bool_required.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/bool_required.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: required is meaningless for bool diff --git a/tests/ui/flatten_and_doc.rs b/tests/ui/flatten_and_doc.rs new file mode 100644 index 00000000..2a6e83b7 --- /dev/null +++ b/tests/ui/flatten_and_doc.rs @@ -0,0 +1,32 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt)] +struct DaemonOpts { + #[structopt(short)] + user: String, + #[structopt(short)] + group: String, +} + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + /// Opts. + #[structopt(flatten)] + opts: DaemonOpts, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/flatten_and_doc.stderr b/tests/ui/flatten_and_doc.stderr new file mode 100644 index 00000000..9d403ad9 --- /dev/null +++ b/tests/ui/flatten_and_doc.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/flatten_and_doc.rs:21:10 + | +21 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: methods and doc comments are not allowed for flattened entry diff --git a/tests/ui/flatten_and_methods.rs b/tests/ui/flatten_and_methods.rs new file mode 100644 index 00000000..cf63a1e9 --- /dev/null +++ b/tests/ui/flatten_and_methods.rs @@ -0,0 +1,31 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt)] +struct DaemonOpts { + #[structopt(short)] + user: String, + #[structopt(short)] + group: String, +} + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt(short, flatten)] + opts: DaemonOpts, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/flatten_and_methods.stderr b/tests/ui/flatten_and_methods.stderr new file mode 100644 index 00000000..137c8bbd --- /dev/null +++ b/tests/ui/flatten_and_methods.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/flatten_and_methods.rs:21:10 + | +21 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: methods and doc comments are not allowed for flattened entry diff --git a/tests/ui/flatten_and_parse.rs b/tests/ui/flatten_and_parse.rs new file mode 100644 index 00000000..a04b426c --- /dev/null +++ b/tests/ui/flatten_and_parse.rs @@ -0,0 +1,31 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt)] +struct DaemonOpts { + #[structopt(short)] + user: String, + #[structopt(short)] + group: String, +} + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt(flatten, parse(from_occurrences))] + opts: DaemonOpts, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/flatten_and_parse.stderr b/tests/ui/flatten_and_parse.stderr new file mode 100644 index 00000000..ffa10aa1 --- /dev/null +++ b/tests/ui/flatten_and_parse.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/flatten_and_parse.rs:21:10 + | +21 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: parse attribute is not allowed for flattened entry diff --git a/tests/ui/literal_list_element.rs b/tests/ui/literal_list_element.rs new file mode 100644 index 00000000..ccd41c7c --- /dev/null +++ b/tests/ui/literal_list_element.rs @@ -0,0 +1,24 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt(test(1, 2))] + debug: bool, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} + diff --git a/tests/ui/literal_list_element.stderr b/tests/ui/literal_list_element.stderr new file mode 100644 index 00000000..b7cd3feb --- /dev/null +++ b/tests/ui/literal_list_element.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/literal_list_element.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: unsupported option: test ( 1 , 2 ) diff --git a/tests/ui/non_existent_attr.rs b/tests/ui/non_existent_attr.rs new file mode 100644 index 00000000..0d16f343 --- /dev/null +++ b/tests/ui/non_existent_attr.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt(short, non_existing_attribute = 1)] + debug: bool, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/non_existent_attr.stderr b/tests/ui/non_existent_attr.stderr new file mode 100644 index 00000000..212221a9 --- /dev/null +++ b/tests/ui/non_existent_attr.stderr @@ -0,0 +1,7 @@ +error[E0599]: no method named `non_existing_attribute` found for type `structopt::clap::Arg<'_, '_>` in the current scope + --> $DIR/non_existent_attr.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/non_literal_attr_value.rs b/tests/ui/non_literal_attr_value.rs new file mode 100644 index 00000000..da207b2a --- /dev/null +++ b/tests/ui/non_literal_attr_value.rs @@ -0,0 +1,24 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt(short, aliases = &["debug", "dbg"])] + debug: bool, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} + diff --git a/tests/ui/non_literal_attr_value.stderr b/tests/ui/non_literal_attr_value.stderr new file mode 100644 index 00000000..d7277c0c --- /dev/null +++ b/tests/ui/non_literal_attr_value.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/non_literal_attr_value.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: invalid structopt syntax: expected literal: # [ structopt ( short , aliases = & [ "debug" , "dbg" ] ) ] diff --git a/tests/ui/opt_opt_nonpositional.rs b/tests/ui/opt_opt_nonpositional.rs new file mode 100644 index 00000000..f0441f60 --- /dev/null +++ b/tests/ui/opt_opt_nonpositional.rs @@ -0,0 +1,22 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + n: Option>, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/opt_opt_nonpositional.stderr b/tests/ui/opt_opt_nonpositional.stderr new file mode 100644 index 00000000..5c04df80 --- /dev/null +++ b/tests/ui/opt_opt_nonpositional.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/opt_opt_nonpositional.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: Option> type is meaningless for positional argument diff --git a/tests/ui/opt_vec_nonpositional.rs b/tests/ui/opt_vec_nonpositional.rs new file mode 100644 index 00000000..9f45d683 --- /dev/null +++ b/tests/ui/opt_vec_nonpositional.rs @@ -0,0 +1,22 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + n: Option>, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/opt_vec_nonpositional.stderr b/tests/ui/opt_vec_nonpositional.stderr new file mode 100644 index 00000000..6bf3bf73 --- /dev/null +++ b/tests/ui/opt_vec_nonpositional.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/opt_vec_nonpositional.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: Option> type is meaningless for positional argument diff --git a/tests/ui/option_default_value.rs b/tests/ui/option_default_value.rs new file mode 100644 index 00000000..ed13358f --- /dev/null +++ b/tests/ui/option_default_value.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt(short, default_value = 1)] + n: Option, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/option_default_value.stderr b/tests/ui/option_default_value.stderr new file mode 100644 index 00000000..259d56e9 --- /dev/null +++ b/tests/ui/option_default_value.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/option_default_value.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: default_value is meaningless for Option diff --git a/tests/ui/option_required.rs b/tests/ui/option_required.rs new file mode 100644 index 00000000..401e34eb --- /dev/null +++ b/tests/ui/option_required.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt(short, required = true)] + n: Option, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/option_required.stderr b/tests/ui/option_required.stderr new file mode 100644 index 00000000..f8c30488 --- /dev/null +++ b/tests/ui/option_required.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/option_required.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: required is meaningless for Option diff --git a/tests/ui/parse_empty_try_from_os.rs b/tests/ui/parse_empty_try_from_os.rs new file mode 100644 index 00000000..c0082b52 --- /dev/null +++ b/tests/ui/parse_empty_try_from_os.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt(parse(try_from_os_str))] + s: String, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/parse_empty_try_from_os.stderr b/tests/ui/parse_empty_try_from_os.stderr new file mode 100644 index 00000000..f6485737 --- /dev/null +++ b/tests/ui/parse_empty_try_from_os.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/parse_empty_try_from_os.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: cannot omit parser function name with `try_from_os_str` diff --git a/tests/ui/parse_function_is_not_path.rs b/tests/ui/parse_function_is_not_path.rs new file mode 100644 index 00000000..6ef3639e --- /dev/null +++ b/tests/ui/parse_function_is_not_path.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt(parse(from_str = "2"))] + s: String, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/parse_function_is_not_path.stderr b/tests/ui/parse_function_is_not_path.stderr new file mode 100644 index 00000000..14d092b1 --- /dev/null +++ b/tests/ui/parse_function_is_not_path.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/parse_function_is_not_path.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: parser function path: Error("expected identifier") diff --git a/tests/ui/parse_literal_spec.rs b/tests/ui/parse_literal_spec.rs new file mode 100644 index 00000000..f93df286 --- /dev/null +++ b/tests/ui/parse_literal_spec.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt(parse("from_str"))] + s: String, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/parse_literal_spec.stderr b/tests/ui/parse_literal_spec.stderr new file mode 100644 index 00000000..cdc3388f --- /dev/null +++ b/tests/ui/parse_literal_spec.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/parse_literal_spec.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: unknown value parser specification: "from_str" diff --git a/tests/ui/parse_not_zero_args.rs b/tests/ui/parse_not_zero_args.rs new file mode 100644 index 00000000..0c68d44c --- /dev/null +++ b/tests/ui/parse_not_zero_args.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt(parse(from_str, from_str))] + s: String, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/parse_not_zero_args.stderr b/tests/ui/parse_not_zero_args.stderr new file mode 100644 index 00000000..b565ca02 --- /dev/null +++ b/tests/ui/parse_not_zero_args.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/parse_not_zero_args.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: parse must have exactly one argument diff --git a/tests/ui/raw_wrong_entry.rs b/tests/ui/raw_wrong_entry.rs new file mode 100644 index 00000000..a815ed96 --- /dev/null +++ b/tests/ui/raw_wrong_entry.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt(raw(1))] + s: String, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/raw_wrong_entry.stderr b/tests/ui/raw_wrong_entry.stderr new file mode 100644 index 00000000..5e2e5293 --- /dev/null +++ b/tests/ui/raw_wrong_entry.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/raw_wrong_entry.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: unsupported raw entry: 1 diff --git a/tests/ui/rename_all_wrong_casing.rs b/tests/ui/rename_all_wrong_casing.rs new file mode 100644 index 00000000..a3e3ec6d --- /dev/null +++ b/tests/ui/rename_all_wrong_casing.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic", rename_all = "fail")] +struct Opt { + #[structopt(short)] + s: String, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/rename_all_wrong_casing.stderr b/tests/ui/rename_all_wrong_casing.stderr new file mode 100644 index 00000000..fb6d5511 --- /dev/null +++ b/tests/ui/rename_all_wrong_casing.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/rename_all_wrong_casing.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: unsupported casing: fail diff --git a/tests/ui/struct_flatten.rs b/tests/ui/struct_flatten.rs new file mode 100644 index 00000000..ddcf5b3e --- /dev/null +++ b/tests/ui/struct_flatten.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic", flatten)] +struct Opt { + #[structopt(short)] + s: String, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/struct_flatten.stderr b/tests/ui/struct_flatten.stderr new file mode 100644 index 00000000..9e025309 --- /dev/null +++ b/tests/ui/struct_flatten.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/struct_flatten.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: flatten is only allowed on fields diff --git a/tests/ui/struct_parse.rs b/tests/ui/struct_parse.rs new file mode 100644 index 00000000..c21023c1 --- /dev/null +++ b/tests/ui/struct_parse.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic", parse(from_str))] +struct Opt { + #[structopt(short)] + s: String, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/struct_parse.stderr b/tests/ui/struct_parse.stderr new file mode 100644 index 00000000..e994681e --- /dev/null +++ b/tests/ui/struct_parse.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/struct_parse.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: parse attribute is only allowed on fields diff --git a/tests/ui/struct_subcommand.rs b/tests/ui/struct_subcommand.rs new file mode 100644 index 00000000..e2cd7ee3 --- /dev/null +++ b/tests/ui/struct_subcommand.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic", subcommand)] +struct Opt { + #[structopt(short)] + s: String, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/struct_subcommand.stderr b/tests/ui/struct_subcommand.stderr new file mode 100644 index 00000000..d6925f71 --- /dev/null +++ b/tests/ui/struct_subcommand.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/struct_subcommand.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: subcommand is only allowed on fields diff --git a/tests/ui/structopt_empty_attr.rs b/tests/ui/structopt_empty_attr.rs new file mode 100644 index 00000000..f4285a91 --- /dev/null +++ b/tests/ui/structopt_empty_attr.rs @@ -0,0 +1,24 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt] + debug: bool, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} + diff --git a/tests/ui/structopt_empty_attr.stderr b/tests/ui/structopt_empty_attr.stderr new file mode 100644 index 00000000..f25dc2ac --- /dev/null +++ b/tests/ui/structopt_empty_attr.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/structopt_empty_attr.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: unsupported syntax: structopt diff --git a/tests/ui/structopt_name_value_attr.rs b/tests/ui/structopt_name_value_attr.rs new file mode 100644 index 00000000..428c6233 --- /dev/null +++ b/tests/ui/structopt_name_value_attr.rs @@ -0,0 +1,24 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt { + #[structopt = "short"] + debug: bool, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} + diff --git a/tests/ui/structopt_name_value_attr.stderr b/tests/ui/structopt_name_value_attr.stderr new file mode 100644 index 00000000..42838368 --- /dev/null +++ b/tests/ui/structopt_name_value_attr.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/structopt_name_value_attr.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: unsupported syntax: structopt = "short" diff --git a/tests/ui/subcommand_and_flatten.rs b/tests/ui/subcommand_and_flatten.rs new file mode 100644 index 00000000..ed9039de --- /dev/null +++ b/tests/ui/subcommand_and_flatten.rs @@ -0,0 +1,38 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt)] +#[structopt(name = "make-cookie")] +struct MakeCookie { + #[structopt(short)] + s: String, + + #[structopt(subcommand, flatten)] + cmd: Command, +} + +#[derive(StructOpt)] +enum Command { + #[structopt(name = "pound")] + /// Pound acorns into flour for cookie dough. + Pound { acorns: u32 }, + + Sparkle { + #[structopt(short)] + color: String, + }, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/subcommand_and_flatten.stderr b/tests/ui/subcommand_and_flatten.stderr new file mode 100644 index 00000000..3a405808 --- /dev/null +++ b/tests/ui/subcommand_and_flatten.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/subcommand_and_flatten.rs:13:10 + | +13 | #[derive(StructOpt)] + | ^^^^^^^^^ + | + = help: message: subcommands cannot be flattened diff --git a/tests/ui/subcommand_and_methods.rs b/tests/ui/subcommand_and_methods.rs new file mode 100644 index 00000000..1ff09ad0 --- /dev/null +++ b/tests/ui/subcommand_and_methods.rs @@ -0,0 +1,38 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt)] +#[structopt(name = "make-cookie")] +struct MakeCookie { + #[structopt(short)] + s: String, + + #[structopt(subcommand, long)] + cmd: Command, +} + +#[derive(StructOpt)] +enum Command { + #[structopt(name = "pound")] + /// Pound acorns into flour for cookie dough. + Pound { acorns: u32 }, + + Sparkle { + #[structopt(short)] + color: String, + }, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/subcommand_and_methods.stderr b/tests/ui/subcommand_and_methods.stderr new file mode 100644 index 00000000..d174ce3f --- /dev/null +++ b/tests/ui/subcommand_and_methods.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/subcommand_and_methods.rs:13:10 + | +13 | #[derive(StructOpt)] + | ^^^^^^^^^ + | + = help: message: methods in attributes is not allowed for subcommand diff --git a/tests/ui/subcommand_and_parse.rs b/tests/ui/subcommand_and_parse.rs new file mode 100644 index 00000000..e74c4f12 --- /dev/null +++ b/tests/ui/subcommand_and_parse.rs @@ -0,0 +1,38 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt)] +#[structopt(name = "make-cookie")] +struct MakeCookie { + #[structopt(short)] + s: String, + + #[structopt(subcommand, parse(from_occurrences))] + cmd: Command, +} + +#[derive(StructOpt)] +enum Command { + #[structopt(name = "pound")] + /// Pound acorns into flour for cookie dough. + Pound { acorns: u32 }, + + Sparkle { + #[structopt(short)] + color: String, + }, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/subcommand_and_parse.stderr b/tests/ui/subcommand_and_parse.stderr new file mode 100644 index 00000000..7ec25ace --- /dev/null +++ b/tests/ui/subcommand_and_parse.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/subcommand_and_parse.rs:13:10 + | +13 | #[derive(StructOpt)] + | ^^^^^^^^^ + | + = help: message: parse attribute is not allowed for subcommand diff --git a/tests/ui/subcommand_opt_opt.rs b/tests/ui/subcommand_opt_opt.rs new file mode 100644 index 00000000..9fbd5b43 --- /dev/null +++ b/tests/ui/subcommand_opt_opt.rs @@ -0,0 +1,38 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt)] +#[structopt(name = "make-cookie")] +struct MakeCookie { + #[structopt(short)] + s: String, + + #[structopt(subcommand)] + cmd: Option>, +} + +#[derive(StructOpt)] +enum Command { + #[structopt(name = "pound")] + /// Pound acorns into flour for cookie dough. + Pound { acorns: u32 }, + + Sparkle { + #[structopt(short)] + color: String, + }, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/subcommand_opt_opt.stderr b/tests/ui/subcommand_opt_opt.stderr new file mode 100644 index 00000000..0384bcdc --- /dev/null +++ b/tests/ui/subcommand_opt_opt.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/subcommand_opt_opt.rs:13:10 + | +13 | #[derive(StructOpt)] + | ^^^^^^^^^ + | + = help: message: Option> type is not allowed for subcommand diff --git a/tests/ui/subcommand_opt_vec.rs b/tests/ui/subcommand_opt_vec.rs new file mode 100644 index 00000000..9a796fdd --- /dev/null +++ b/tests/ui/subcommand_opt_vec.rs @@ -0,0 +1,38 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt)] +#[structopt(name = "make-cookie")] +struct MakeCookie { + #[structopt(short)] + s: String, + + #[structopt(subcommand)] + cmd: Option>, +} + +#[derive(StructOpt)] +enum Command { + #[structopt(name = "pound")] + /// Pound acorns into flour for cookie dough. + Pound { acorns: u32 }, + + Sparkle { + #[structopt(short)] + color: String, + }, +} + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/subcommand_opt_vec.stderr b/tests/ui/subcommand_opt_vec.stderr new file mode 100644 index 00000000..a8598833 --- /dev/null +++ b/tests/ui/subcommand_opt_vec.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/subcommand_opt_vec.rs:13:10 + | +13 | #[derive(StructOpt)] + | ^^^^^^^^^ + | + = help: message: Option> type is not allowed for subcommand diff --git a/tests/ui/tuple_enum.stderr b/tests/ui/tuple_enum.stderr new file mode 100644 index 00000000..73a51a45 --- /dev/null +++ b/tests/ui/tuple_enum.stderr @@ -0,0 +1,42 @@ +error[E0599]: no function or associated item named `augment_clap` found for type `u32` in the current scope + --> $DIR/tuple_enum.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ function or associated item not found in `u32` + +error[E0599]: no function or associated item named `is_subcommand` found for type `u32` in the current scope + --> $DIR/tuple_enum.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ function or associated item not found in `u32` + +error[E0599]: no function or associated item named `augment_clap` found for type `std::string::String` in the current scope + --> $DIR/tuple_enum.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ function or associated item not found in `std::string::String` + +error[E0599]: no function or associated item named `is_subcommand` found for type `std::string::String` in the current scope + --> $DIR/tuple_enum.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ function or associated item not found in `std::string::String` + +error[E0277]: the trait bound `u32: structopt::StructOpt` is not satisfied + --> $DIR/tuple_enum.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ the trait `structopt::StructOpt` is not implemented for `u32` + | + = note: required by `structopt::StructOpt::from_clap` + +error[E0277]: the trait bound `std::string::String: structopt::StructOpt` is not satisfied + --> $DIR/tuple_enum.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ the trait `structopt::StructOpt` is not implemented for `std::string::String` + | + = note: required by `structopt::StructOpt::from_clap` + +Some errors have detailed explanations: E0277, E0599. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/tuple_struct.rs b/tests/ui/tuple_struct.rs new file mode 100644 index 00000000..8f8c5a32 --- /dev/null +++ b/tests/ui/tuple_struct.rs @@ -0,0 +1,20 @@ +// Copyright 2018 Guillaume Pinot (@TeXitoi) +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate structopt; + +use structopt::StructOpt; + +#[derive(StructOpt, Debug)] +#[structopt(name = "basic")] +struct Opt(u32); + +fn main() { + let opt = Opt::from_args(); + println!("{:?}", opt); +} diff --git a/tests/ui/tuple_struct.stderr b/tests/ui/tuple_struct.stderr new file mode 100644 index 00000000..1626a2a2 --- /dev/null +++ b/tests/ui/tuple_struct.stderr @@ -0,0 +1,7 @@ +error: proc-macro derive panicked + --> $DIR/tuple_struct.rs:13:10 + | +13 | #[derive(StructOpt, Debug)] + | ^^^^^^^^^ + | + = help: message: structopt only supports non-tuple structs and enums From 43c0cf1a157ff7abcdd6191eec28771a64beec7d Mon Sep 17 00:00:00 2001 From: Ivan Veselov Date: Wed, 19 Jun 2019 22:31:38 +0100 Subject: [PATCH 2/2] Remove unneeded .stderr test file --- tests/ui/tuple_enum.stderr | 42 -------------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 tests/ui/tuple_enum.stderr diff --git a/tests/ui/tuple_enum.stderr b/tests/ui/tuple_enum.stderr deleted file mode 100644 index 73a51a45..00000000 --- a/tests/ui/tuple_enum.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0599]: no function or associated item named `augment_clap` found for type `u32` in the current scope - --> $DIR/tuple_enum.rs:13:10 - | -13 | #[derive(StructOpt, Debug)] - | ^^^^^^^^^ function or associated item not found in `u32` - -error[E0599]: no function or associated item named `is_subcommand` found for type `u32` in the current scope - --> $DIR/tuple_enum.rs:13:10 - | -13 | #[derive(StructOpt, Debug)] - | ^^^^^^^^^ function or associated item not found in `u32` - -error[E0599]: no function or associated item named `augment_clap` found for type `std::string::String` in the current scope - --> $DIR/tuple_enum.rs:13:10 - | -13 | #[derive(StructOpt, Debug)] - | ^^^^^^^^^ function or associated item not found in `std::string::String` - -error[E0599]: no function or associated item named `is_subcommand` found for type `std::string::String` in the current scope - --> $DIR/tuple_enum.rs:13:10 - | -13 | #[derive(StructOpt, Debug)] - | ^^^^^^^^^ function or associated item not found in `std::string::String` - -error[E0277]: the trait bound `u32: structopt::StructOpt` is not satisfied - --> $DIR/tuple_enum.rs:13:10 - | -13 | #[derive(StructOpt, Debug)] - | ^^^^^^^^^ the trait `structopt::StructOpt` is not implemented for `u32` - | - = note: required by `structopt::StructOpt::from_clap` - -error[E0277]: the trait bound `std::string::String: structopt::StructOpt` is not satisfied - --> $DIR/tuple_enum.rs:13:10 - | -13 | #[derive(StructOpt, Debug)] - | ^^^^^^^^^ the trait `structopt::StructOpt` is not implemented for `std::string::String` - | - = note: required by `structopt::StructOpt::from_clap` - -Some errors have detailed explanations: E0277, E0599. -For more information about an error, try `rustc --explain E0277`.