mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
Auto merge of #377 - sru:scopewide, r=kbknapp
Scopewide attributes For `tests/yaml.rs`, it makes sense to use scope wide attribute, which applies to the whole file, because yaml test will not be tested without yaml feature. For `examples/17_yaml.rs`, I moved the `use` statement inside so that seemingly random unused import warning doesn't pop up. For `tests/unicode.rs`, well, I tried fiddling around with unicode with Windows without much success...
This commit is contained in:
commit
68d43311e0
3 changed files with 9 additions and 9 deletions
|
@ -17,10 +17,10 @@
|
|||
#[macro_use]
|
||||
extern crate clap;
|
||||
|
||||
use clap::App;
|
||||
|
||||
#[cfg(feature = "yaml")]
|
||||
fn main() {
|
||||
use clap::App;
|
||||
|
||||
// To load a yaml file containing our CLI definition such as the example '17_yaml.yml' we can
|
||||
// use the convenience macro which loads the file at compile relative to the current file
|
||||
// similiar to how modules are found.
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#![cfg(not(windows))]
|
||||
|
||||
extern crate clap;
|
||||
|
||||
use std::ffi::OsString;
|
||||
#[cfg(not(windows))]
|
||||
use std::os::unix::ffi::OsStringExt;
|
||||
use clap::{App, Arg, ClapErrorType};
|
||||
|
||||
#[cfg_attr(not(windows), test)]
|
||||
#[cfg(not(windows))]
|
||||
#[test]
|
||||
fn invalid_unicode_safe() {
|
||||
let m = App::new("bad_unicode")
|
||||
.arg(Arg::from_usage("<arg> 'some arg'"))
|
||||
|
@ -18,8 +18,7 @@ fn invalid_unicode_safe() {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(not(windows), test)]
|
||||
#[cfg(not(windows))]
|
||||
#[test]
|
||||
fn invalid_unicode_lossy() {
|
||||
if let Ok(m) = App::new("bad_unicode")
|
||||
.arg(Arg::from_usage("<arg> 'some arg'"))
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#![cfg(feature="yaml")]
|
||||
|
||||
#[macro_use]
|
||||
extern crate clap;
|
||||
|
||||
use clap::App;
|
||||
|
||||
#[test]
|
||||
#[cfg(feature="yaml")]
|
||||
fn create_app_from_yaml() {
|
||||
let yml = load_yaml!("app.yml");
|
||||
App::from_yaml(yml);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue