@@ -763,6 +763,8 @@ fn test_usage() {
763
763
opts. optopt ( "a" , "012345678901234567890123456789" , "Desc" , "VAL" ) ;
764
764
opts. optflag ( "k" , "kiwi" , "Desc" ) ;
765
765
opts. optflagopt ( "p" , "" , "Desc" , "VAL" ) ;
766
+ opts. optflagopt ( "" , "pea" , "Desc" , "VAL" ) ;
767
+ opts. optflagopt ( "c" , "cherry" , "Desc" , "VAL" ) ;
766
768
opts. optmulti ( "l" , "" , "Desc" , "VAL" ) ;
767
769
opts. optflag ( "" , "starfruit" , "Starfruit" ) ;
768
770
@@ -773,7 +775,9 @@ Options:
773
775
-a, --012345678901234567890123456789 VAL
774
776
Desc
775
777
-k, --kiwi Desc
776
- -p [VAL] Desc
778
+ -p[VAL] Desc
779
+ --pea[=VAL] Desc
780
+ -c, --cherry[=VAL] Desc
777
781
-l VAL Desc
778
782
--starfruit Starfruit
779
783
" ;
@@ -820,7 +824,7 @@ Options:
820
824
821
825
debug ! ( "expected: <<{}>>" , expected) ;
822
826
debug ! ( "generated: <<{}>>" , usage) ;
823
- assert ! ( usage == expected)
827
+ assert_eq ! ( usage, expected)
824
828
}
825
829
826
830
#[ test]
@@ -851,7 +855,7 @@ Options:
851
855
852
856
debug ! ( "expected: <<{}>>" , expected) ;
853
857
debug ! ( "generated: <<{}>>" , usage) ;
854
- assert ! ( usage == expected)
858
+ assert_eq ! ( usage, expected)
855
859
}
856
860
857
861
#[ test]
@@ -882,7 +886,7 @@ Options:
882
886
883
887
debug ! ( "expected: <<{}>>" , expected) ;
884
888
debug ! ( "generated: <<{}>>" , usage) ;
885
- assert ! ( usage == expected)
889
+ assert_eq ! ( usage, expected)
886
890
}
887
891
888
892
#[ test]
@@ -909,7 +913,7 @@ Options:
909
913
-c, --brûlée brûlée quite long description
910
914
-k, --kiwi€ kiwi description
911
915
-o, --orange‹ orange description
912
- -r, --raspberry-but-making-this-option-way-too-long\u{0020}
916
+ -r, --raspberry-but-making-this-option-way-too-long
913
917
raspberry description is also quite long indeed longer
914
918
than every other piece of text we might encounter here
915
919
and thus will be automatically broken up
@@ -919,7 +923,7 @@ Options:
919
923
920
924
debug ! ( "expected: <<{}>>" , expected) ;
921
925
debug ! ( "generated: <<{}>>" , usage) ;
922
- assert ! ( usage == expected)
926
+ assert_eq ! ( usage, expected)
923
927
}
924
928
925
929
#[ test]
@@ -934,13 +938,13 @@ fn test_usage_short_only() {
934
938
Options:
935
939
-k VAL Kiwi
936
940
-s Starfruit
937
- -a [TYPE] Apple
941
+ -a[TYPE] Apple
938
942
" ;
939
943
940
944
let usage = opts. usage ( "Usage: fruits" ) ;
941
945
debug ! ( "expected: <<{}>>" , expected) ;
942
946
debug ! ( "generated: <<{}>>" , usage) ;
943
- assert ! ( usage == expected)
947
+ assert_eq ! ( usage, expected)
944
948
}
945
949
946
950
#[ test]
@@ -955,13 +959,13 @@ fn test_usage_long_only() {
955
959
Options:
956
960
--kiwi VAL Kiwi
957
961
--starfruit Starfruit
958
- --apple [ TYPE] Apple
962
+ --apple[= TYPE] Apple
959
963
" ;
960
964
961
965
let usage = opts. usage ( "Usage: fruits" ) ;
962
966
debug ! ( "expected: <<{}>>" , expected) ;
963
967
debug ! ( "generated: <<{}>>" , usage) ;
964
- assert ! ( usage == expected)
968
+ assert_eq ! ( usage, expected)
965
969
}
966
970
967
971
#[ test]
@@ -971,9 +975,10 @@ fn test_short_usage() {
971
975
opts. optopt ( "a" , "012345678901234567890123456789" , "Desc" , "VAL" ) ;
972
976
opts. optflag ( "k" , "kiwi" , "Desc" ) ;
973
977
opts. optflagopt ( "p" , "" , "Desc" , "VAL" ) ;
974
- opts. optmulti ( "l" , "" , "Desc" , "VAL" ) ;
978
+ opts. optflagopt ( "" , "pea" , "Desc" , "VAL" ) ;
979
+ opts. optflagopt ( "c" , "cherry" , "Desc" , "VAL" ) ;
975
980
976
- let expected = "Usage: fruits -b VAL [-a VAL] [-k] [-p [VAL]] [-l VAL].. " . to_string ( ) ;
981
+ let expected = "Usage: fruits -b VAL [-a VAL] [-k] [-p[VAL]] [--pea[=VAL]] [-c[ VAL]] " . to_string ( ) ;
977
982
let generated_usage = opts. short_usage ( "fruits" ) ;
978
983
979
984
debug ! ( "expected: <<{}>>" , expected) ;
@@ -1026,7 +1031,7 @@ Options:
1026
1031
1027
1032
debug ! ( "expected: <<{}>>" , expected) ;
1028
1033
debug ! ( "generated: <<{}>>" , usage) ;
1029
- assert ! ( usage == expected)
1034
+ assert_eq ! ( usage, expected)
1030
1035
}
1031
1036
1032
1037
#[ test]
0 commit comments