Skip to content

Commit

Permalink
Auto merge of #377 - sru:scopewide, r=kbknapp
Browse files Browse the repository at this point in the history
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...
  • Loading branch information
homu committed Jan 12, 2016
2 parents b1264b7 + 3936b28 commit 68d4331
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/17_yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 4 additions & 5 deletions tests/unicode.rs
Original file line number Diff line number Diff line change
@@ -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'"))
Expand All @@ -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'"))
Expand Down
5 changes: 3 additions & 2 deletions tests/yaml.rs
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit 68d4331

Please sign in to comment.