|
13 | 13 | )
|
14 | 14 | end
|
15 | 15 |
|
| 16 | + it "parses a 'long' option with a value and converts '-' to '_' & warns" do |
| 17 | + parses( |
| 18 | + :option => ["--an_gry", "Angry", :REQUIRED], |
| 19 | + :from_arguments => ["--an-gry", "foo"], |
| 20 | + :expects => "foo" |
| 21 | + ) |
| 22 | + expect(@logs).to have_matching_log(/Partial argument match detected. Partial argument matching will be deprecated in Puppet 9./) |
| 23 | + end |
| 24 | + |
| 25 | + it "parses a 'long' option with a value and converts '_' to '-' & warns" do |
| 26 | + parses( |
| 27 | + :option => ["--an-gry", "Angry", :REQUIRED], |
| 28 | + :from_arguments => ["--an_gry", "foo"], |
| 29 | + :expects => "foo" |
| 30 | + ) |
| 31 | + expect(@logs).to have_matching_log(/Partial argument match detected. Partial argument matching will be deprecated in Puppet 9./) |
| 32 | + end |
| 33 | + |
16 | 34 | it "parses a 'short' option with a value" do
|
17 | 35 | parses(
|
18 | 36 | :option => ["--angry", "-a", "Angry", :REQUIRED],
|
|
39 | 57 | )
|
40 | 58 | end
|
41 | 59 |
|
| 60 | + it "converts '_' to '-' with a 'long' option & warns" do |
| 61 | + parses( |
| 62 | + :option => ["--an-gry", "Angry", :NONE], |
| 63 | + :from_arguments => ["--an_gry"], |
| 64 | + :expects => true |
| 65 | + ) |
| 66 | + expect(@logs).to have_matching_log(/Partial argument match detected. Partial argument matching will be deprecated in Puppet 9./) |
| 67 | + end |
| 68 | + |
| 69 | + it "converts '-' to '_' with a 'long' option & warns" do |
| 70 | + parses( |
| 71 | + :option => ["--an_gry", "Angry", :NONE], |
| 72 | + :from_arguments => ["--an-gry"], |
| 73 | + :expects => true |
| 74 | + ) |
| 75 | + expect(@logs).to have_matching_log(/Partial argument match detected. Partial argument matching will be deprecated in Puppet 9./) |
| 76 | + end |
| 77 | + |
42 | 78 | it "parses a 'short' option" do
|
43 | 79 | parses(
|
44 | 80 | :option => ["--angry", "-a", "Angry", :NONE],
|
|
55 | 91 | )
|
56 | 92 | end
|
57 | 93 |
|
| 94 | + it "resolves '-' to '_' with '--no-blah' syntax" do |
| 95 | + parses( |
| 96 | + :option => ["--[no-]an_gry", "Angry", :NONE], |
| 97 | + :from_arguments => ["--no-an-gry"], |
| 98 | + :expects => false |
| 99 | + ) |
| 100 | + end |
| 101 | + |
| 102 | + it "resolves '_' to '-' with '--no-blah' syntax" do |
| 103 | + parses( |
| 104 | + :option => ["--[no-]an-gry", "Angry", :NONE], |
| 105 | + :from_arguments => ["--no-an_gry"], |
| 106 | + :expects => false |
| 107 | + ) |
| 108 | + end |
| 109 | + |
| 110 | + it "resolves '-' to '_' & warns when option is defined with '--no-blah syntax' but argument is given in '--option' syntax" do |
| 111 | + parses( |
| 112 | + :option => ["--[no-]rag-e", "Rage", :NONE], |
| 113 | + :from_arguments => ["--rag_e"], |
| 114 | + :expects => true |
| 115 | + ) |
| 116 | + expect(@logs).to have_matching_log(/Partial argument match detected. Partial argument matching will be deprecated in Puppet 9./) |
| 117 | + end |
| 118 | + |
| 119 | + it "resolves '_' to '-' & warns when option is defined with '--no-blah syntax' but argument is given in '--option' syntax" do |
| 120 | + parses( |
| 121 | + :option => ["--[no-]rag_e", "Rage", :NONE], |
| 122 | + :from_arguments => ["--rag-e"], |
| 123 | + :expects => true |
| 124 | + ) |
| 125 | + expect(@logs).to have_matching_log(/Partial argument match detected. Partial argument matching will be deprecated in Puppet 9./) |
| 126 | + end |
| 127 | + |
58 | 128 | it "overrides a previous argument with a later one" do
|
59 | 129 | parses(
|
60 | 130 | :option => ["--[no-]rage", "Rage", :NONE],
|
|
0 commit comments