// Copyright 2018 David Roundy // // 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. #[macro_use] extern crate clapme; use clapme::ClapMe; #[derive(Debug, ClapMe, PartialEq, Eq)] struct SubOpt { max_iter: Option, quiet: bool, } #[derive(Debug, ClapMe, PartialEq, Eq)] struct Opt { foo: String, _report: SubOpt, } #[derive(Debug, ClapMe, PartialEq, Eq)] enum Parent { CaseOne, _CaseTwo(Opt), } #[test] fn craziness() { println!("help: {}", Parent::help_message("foo")); assert!(Parent::help_message("foo").contains("--quiet ")); assert_eq!(Parent::_CaseTwo(Opt { foo: "foo".to_string(), _report: SubOpt { max_iter: None, quiet: false, } }), Parent::from_iter(&["", "--foo=foo"]).unwrap()); }