-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1992: fix(clap_derive): Unwrap `syn::TypeGroup` when checking field types r=CreepySkeleton a=Aaron1011 Co-authored-by: Aaron Hill <[email protected]>
- Loading branch information
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2018 Guillaume Pinot (@TeXitoi) <[email protected]>, | ||
// Kevin Knapp (@kbknapp) <[email protected]>, and | ||
// Andrew Hobden (@hoverbear) <[email protected]> | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
// | ||
// This work was derived from Structopt (https://github.com/TeXitoi/structopt) | ||
// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the | ||
// MIT/Apache 2.0 license. | ||
|
||
use clap::Clap; | ||
|
||
// Tests that clap_derive properly detects an `Option` field | ||
// that results from a macro expansion | ||
#[test] | ||
fn use_option() { | ||
macro_rules! expand_ty { | ||
($name:ident: $ty:ty) => { | ||
#[derive(Clap)] | ||
struct Outer { | ||
#[clap(short, long)] | ||
#[allow(dead_code)] | ||
$name: $ty, | ||
} | ||
}; | ||
} | ||
|
||
expand_ty!(my_field: Option<String>); | ||
} |