File tree Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,9 @@ pub trait AppExt: Sized {
100
100
101
101
fn arg_features ( self ) -> Self {
102
102
self . _arg (
103
- opt ( "features" , "Space-separated list of features to activate" ) . value_name ( "FEATURES" ) ,
103
+ opt ( "features" , "Space-separated list of features to activate" )
104
+ . multiple ( true )
105
+ . value_name ( "FEATURES" ) ,
104
106
)
105
107
. _arg ( opt ( "all-features" , "Activate all available features" ) )
106
108
. _arg ( opt (
Original file line number Diff line number Diff line change @@ -1911,3 +1911,60 @@ fn no_feature_for_non_optional_dep() {
1911
1911
1912
1912
p. cargo ( "build --features bar/a" ) . run ( ) ;
1913
1913
}
1914
+
1915
+ #[ cargo_test]
1916
+ fn features_option_given_twice ( ) {
1917
+ let p = project ( )
1918
+ . file (
1919
+ "Cargo.toml" ,
1920
+ r#"
1921
+ [project]
1922
+ name = "foo"
1923
+ version = "0.0.1"
1924
+ authors = []
1925
+
1926
+ [features]
1927
+ a = []
1928
+ b = []
1929
+ "# ,
1930
+ )
1931
+ . file (
1932
+ "src/main.rs" ,
1933
+ r#"
1934
+ #[cfg(all(feature = "a", feature = "b"))]
1935
+ fn main() {}
1936
+ "# ,
1937
+ )
1938
+ . build ( ) ;
1939
+
1940
+ p. cargo ( "build --features a --features b" ) . run ( ) ;
1941
+ }
1942
+
1943
+ #[ cargo_test]
1944
+ fn multi_multi_features ( ) {
1945
+ let p = project ( )
1946
+ . file (
1947
+ "Cargo.toml" ,
1948
+ r#"
1949
+ [project]
1950
+ name = "foo"
1951
+ version = "0.0.1"
1952
+ authors = []
1953
+
1954
+ [features]
1955
+ a = []
1956
+ b = []
1957
+ c = []
1958
+ "# ,
1959
+ )
1960
+ . file (
1961
+ "src/main.rs" ,
1962
+ r#"
1963
+ #[cfg(all(feature = "a", feature = "b", feature = "c"))]
1964
+ fn main() {}
1965
+ "# ,
1966
+ )
1967
+ . build ( ) ;
1968
+
1969
+ p. cargo ( "build --features a --features" ) . arg ( "b c" ) . run ( ) ;
1970
+ }
You can’t perform that action at this time.
0 commit comments