@@ -763,6 +763,8 @@ fn test_usage() {
763763 opts. optopt ( "a" , "012345678901234567890123456789" , "Desc" , "VAL" ) ;
764764 opts. optflag ( "k" , "kiwi" , "Desc" ) ;
765765 opts. optflagopt ( "p" , "" , "Desc" , "VAL" ) ;
766+ opts. optflagopt ( "" , "pea" , "Desc" , "VAL" ) ;
767+ opts. optflagopt ( "c" , "cherry" , "Desc" , "VAL" ) ;
766768 opts. optmulti ( "l" , "" , "Desc" , "VAL" ) ;
767769 opts. optflag ( "" , "starfruit" , "Starfruit" ) ;
768770
@@ -773,7 +775,9 @@ Options:
773775 -a, --012345678901234567890123456789 VAL
774776 Desc
775777 -k, --kiwi Desc
776- -p [VAL] Desc
778+ -p[VAL] Desc
779+ --pea[=VAL] Desc
780+ -c, --cherry[=VAL] Desc
777781 -l VAL Desc
778782 --starfruit Starfruit
779783" ;
@@ -820,7 +824,7 @@ Options:
820824
821825 debug ! ( "expected: <<{}>>" , expected) ;
822826 debug ! ( "generated: <<{}>>" , usage) ;
823- assert ! ( usage == expected)
827+ assert_eq ! ( usage, expected)
824828}
825829
826830#[ test]
@@ -851,7 +855,7 @@ Options:
851855
852856 debug ! ( "expected: <<{}>>" , expected) ;
853857 debug ! ( "generated: <<{}>>" , usage) ;
854- assert ! ( usage == expected)
858+ assert_eq ! ( usage, expected)
855859}
856860
857861#[ test]
@@ -882,7 +886,7 @@ Options:
882886
883887 debug ! ( "expected: <<{}>>" , expected) ;
884888 debug ! ( "generated: <<{}>>" , usage) ;
885- assert ! ( usage == expected)
889+ assert_eq ! ( usage, expected)
886890}
887891
888892#[ test]
@@ -909,7 +913,7 @@ Options:
909913 -c, --brûlée brûlée quite long description
910914 -k, --kiwi€ kiwi description
911915 -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
913917 raspberry description is also quite long indeed longer
914918 than every other piece of text we might encounter here
915919 and thus will be automatically broken up
@@ -919,7 +923,7 @@ Options:
919923
920924 debug ! ( "expected: <<{}>>" , expected) ;
921925 debug ! ( "generated: <<{}>>" , usage) ;
922- assert ! ( usage == expected)
926+ assert_eq ! ( usage, expected)
923927}
924928
925929#[ test]
@@ -934,13 +938,13 @@ fn test_usage_short_only() {
934938Options:
935939 -k VAL Kiwi
936940 -s Starfruit
937- -a [TYPE] Apple
941+ -a[TYPE] Apple
938942" ;
939943
940944 let usage = opts. usage ( "Usage: fruits" ) ;
941945 debug ! ( "expected: <<{}>>" , expected) ;
942946 debug ! ( "generated: <<{}>>" , usage) ;
943- assert ! ( usage == expected)
947+ assert_eq ! ( usage, expected)
944948}
945949
946950#[ test]
@@ -955,13 +959,13 @@ fn test_usage_long_only() {
955959Options:
956960 --kiwi VAL Kiwi
957961 --starfruit Starfruit
958- --apple [ TYPE] Apple
962+ --apple[= TYPE] Apple
959963" ;
960964
961965 let usage = opts. usage ( "Usage: fruits" ) ;
962966 debug ! ( "expected: <<{}>>" , expected) ;
963967 debug ! ( "generated: <<{}>>" , usage) ;
964- assert ! ( usage == expected)
968+ assert_eq ! ( usage, expected)
965969}
966970
967971#[ test]
@@ -971,9 +975,10 @@ fn test_short_usage() {
971975 opts. optopt ( "a" , "012345678901234567890123456789" , "Desc" , "VAL" ) ;
972976 opts. optflag ( "k" , "kiwi" , "Desc" ) ;
973977 opts. optflagopt ( "p" , "" , "Desc" , "VAL" ) ;
974- opts. optmulti ( "l" , "" , "Desc" , "VAL" ) ;
978+ opts. optflagopt ( "" , "pea" , "Desc" , "VAL" ) ;
979+ opts. optflagopt ( "c" , "cherry" , "Desc" , "VAL" ) ;
975980
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 ( ) ;
977982 let generated_usage = opts. short_usage ( "fruits" ) ;
978983
979984 debug ! ( "expected: <<{}>>" , expected) ;
@@ -1026,7 +1031,7 @@ Options:
10261031
10271032 debug ! ( "expected: <<{}>>" , expected) ;
10281033 debug ! ( "generated: <<{}>>" , usage) ;
1029- assert ! ( usage == expected)
1034+ assert_eq ! ( usage, expected)
10301035}
10311036
10321037#[ test]
0 commit comments