Add Task#[]
This commit is contained in:
1 parent
f2a56f1c61
commit
ac0f6087fc
3 files changed
+44
No files matched your search
@@ -2885,6 +2885,27 @@ EOF
|
||||
expect(result.stdout).to eq %[four\nmyparam:"cli-value"\nmyp2:"--myp2"\none\n]
|
||||
end
|
||||
|
||||
it "allows accessing task arguments via Task#[]" do
|
||||
test_dir "tasks"
|
||||
result = run_rscons(args: %w[-f tasks.rb configure])
|
||||
result = run_rscons(args: %w[-f tasks.rb five])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to match /four myparam value is defaultvalue/
|
||||
result = run_rscons(args: %w[-f tasks.rb four --myparam=v42 five])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to match /four myparam value is v42/
|
||||
end
|
||||
|
||||
it "exits with an error when attempting to get a nonexistent parameter value" do
|
||||
test_dir "tasks"
|
||||
result = run_rscons(args: %w[-f tasks.rb configure])
|
||||
result = run_rscons(args: %w[-f tasks.rb six])
|
||||
expect(result.stderr).to match /Could not find parameter 'nope'/
|
||||
expect(result.status).to_not eq 0
|
||||
end
|
||||
|
||||
it "displays tasks and their arguments in the help info" do
|
||||
test_dir "tasks"
|
||||
result = run_rscons(args: %w[-f tasks.rb -h])
|
||||
|
||||
Reference in new issue
Block a user