Skip to content

Commit

Permalink
add a spec
Browse files Browse the repository at this point in the history
  • Loading branch information
evanbattaglia committed Jul 28, 2024
1 parent 5e71e71 commit 8db4c58
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spec/fixtures/vehicles.tabry
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ desc "Build and control vehicles"
flag verbose,v "Give more details in output"

sub build {
varargs vehicle-types @vehicle-type-arg
varargs vehicle-types @vehicle-type
}

sub list-vehicles
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/vehicles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ main:
- name: vehicle-types
options:
- type: include
value: vehicle-type-arg
value: vehicle-type
varargs: true
- name: list-vehicles
- name: move
Expand Down
5 changes: 5 additions & 0 deletions spec/tabry/options_finder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require_relative "../../lib/tabry/options_finder"
require_relative "../../lib/tabry/result"
require_relative "../../lib/tabry/state"
require_relative "../../lib/tabry/util"

describe Tabry::OptionsFinder do
let(:config_fixture) { "#{__dir__}/../fixtures/vehicles.yaml" }
Expand All @@ -23,6 +24,10 @@
%w[car bike],
subs: %w[move go]
],
"lists options for varargs" => [
%w[car bike],
subs: %w[build],
],
"lists both possible args and subs if a subcommand can take either" => [
%w[x y z subsub],
subs: %w[sub-with-sub-or-arg]
Expand Down

0 comments on commit 8db4c58

Please sign in to comment.