@@ -48,7 +48,7 @@ defmodule OptionParserTest do
4848 assert OptionParser . parse ( [ "--no-bool" ] , strict: [ ] )
4949 == { [ ] , [ ] , [ { "--no-bool" , nil } ] }
5050 assert OptionParser . parse ( [ "--no-bool=..." , "other" ] )
51- == { [ ] , [ "other "] , [ { "--no-bool" , "..." } ] }
51+ == { [ no_bool: "... "] , [ "other" ] , [ ] }
5252 end
5353
5454 test "does not parse -- as an alias" do
@@ -103,7 +103,7 @@ defmodule OptionParserTest do
103103 assert OptionParser . parse ( [ "--value" ] , switches: [ value: :string ] )
104104 == { [ ] , [ ] , [ { "--value" , nil } ] }
105105 assert OptionParser . parse ( [ "--no-value" ] , switches: [ value: :string ] )
106- == { [ ] , [ ] , [ { "--no-value" , nil } ] }
106+ == { [ no_value: true ] , [ ] , [ ] }
107107 end
108108
109109 test "parses configured integers" do
@@ -134,11 +134,6 @@ defmodule OptionParserTest do
134134 == { [ ] , [ "foo" ] , [ { "--value" , "WAT" } ] }
135135 end
136136
137- test "parses no switches as flags" do
138- assert OptionParser . parse ( [ "--no-docs" , "foo" ] )
139- == { [ no_docs: true ] , [ "foo" ] , [ ] }
140- end
141-
142137 test "overrides options by default" do
143138 assert OptionParser . parse ( [ "--require" , "foo" , "--require" , "bar" , "baz" ] )
144139 == { [ require: "bar" ] , [ "baz" ] , [ ] }
@@ -157,17 +152,17 @@ defmodule OptionParserTest do
157152 end
158153
159154 test "stops on --" do
160- options = OptionParser . parse ( [ "--source" , "from_docs/ " , "--" , "1" , "2" , "3" ] )
161- assert options == { [ source: "from_docs/ " ] , [ "1" , "2" , "3" ] , [ ] }
155+ options = OptionParser . parse ( [ "--source" , "foo " , "--" , "1" , "2" , "3" ] )
156+ assert options == { [ source: "foo " ] , [ "1" , "2" , "3" ] , [ ] }
162157
163- options = OptionParser . parse_head ( [ "--source" , "from_docs/ " , "--" , "1" , "2" , "3" ] )
164- assert options == { [ source: "from_docs/ " ] , [ "1" , "2" , "3" ] , [ ] }
158+ options = OptionParser . parse_head ( [ "--source" , "foo " , "--" , "1" , "2" , "3" ] )
159+ assert options == { [ source: "foo " ] , [ "1" , "2" , "3" ] , [ ] }
165160
166- options = OptionParser . parse ( [ "--no-dash " , "foo" , "bar" , "--" , "-x" ] )
167- assert options == { [ no_dash: true ] , [ "foo" , "bar" , "-x" ] , [ ] }
161+ options = OptionParser . parse ( [ "--source " , "foo" , "bar" , "--" , "-x" ] )
162+ assert options == { [ source: "foo" ] , [ "bar" , "-x" ] , [ ] }
168163
169- options = OptionParser . parse_head ( [ "--no-dash " , "foo" , "bar" , "--" , "-x" ] )
170- assert options == { [ no_dash: true ] , [ "foo" , "bar" , "--" , "-x" ] , [ ] }
164+ options = OptionParser . parse_head ( [ "--source " , "foo" , "bar" , "--" , "-x" ] )
165+ assert options == { [ source: "foo" ] , [ "bar" , "--" , "-x" ] , [ ] }
171166 end
172167
173168 test "goes beyond the first non option arguments" do
@@ -288,6 +283,6 @@ defmodule OptionParserTest do
288283 assert OptionParser . next ( [ "--bool=" , "..." ] , config )
289284 == { :invalid , "--bool" , "" , [ "..." ] }
290285 assert OptionParser . next ( [ "--no-bool=" , "..." ] , config )
291- == { :undefined , "--no-bool" , "" , [ "..." ] }
286+ == { :invalid , "--no-bool" , "" , [ "..." ] }
292287 end
293288end
0 commit comments