Add specs for tasks
This commit is contained in:
1 parent
c3121f17cf
commit
d11981d4b2
5 files changed
+99
-4
No files matched your search
@@ -2841,4 +2841,64 @@ EOF
|
||||
end
|
||||
end
|
||||
|
||||
it "executes the requested tasks in the requested order" do
|
||||
test_dir "tasks"
|
||||
result = run_rscons(args: %w[-f tasks.rb configure])
|
||||
result = run_rscons(args: %w[-f tasks.rb one three])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to eq "one\nthree\n"
|
||||
result = run_rscons(args: %w[-f tasks.rb three one])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to eq "three\none\n"
|
||||
end
|
||||
|
||||
it "executes the task's dependencies before the requested task" do
|
||||
test_dir "tasks"
|
||||
result = run_rscons(args: %w[-f tasks.rb configure])
|
||||
result = run_rscons(args: %w[-f tasks.rb two])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to eq "one\nthree\ntwo\n"
|
||||
end
|
||||
|
||||
it "does not execute a task more than once" do
|
||||
test_dir "tasks"
|
||||
result = run_rscons(args: %w[-f tasks.rb configure])
|
||||
result = run_rscons(args: %w[-f tasks.rb one two three])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to eq "one\nthree\ntwo\n"
|
||||
end
|
||||
|
||||
it "passes task arguments" do
|
||||
test_dir "tasks"
|
||||
result = run_rscons(args: %w[-f tasks.rb configure])
|
||||
result = run_rscons(args: %w[-f tasks.rb four])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to eq %[four\nmyparam:"defaultvalue"\nmyp2:nil\n]
|
||||
result = run_rscons(args: %w[-f tasks.rb four --myparam=cli-value --myp2 one])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
expect(result.stdout).to eq %[four\nmyparam:"cli-value"\nmyp2:"--myp2"\none\n]
|
||||
end
|
||||
|
||||
it "displays tasks and their arguments in the help info" do
|
||||
test_dir "tasks"
|
||||
result = run_rscons(args: %w[-f tasks.rb -h])
|
||||
expect(result.stderr).to eq ""
|
||||
expect(result.status).to eq 0
|
||||
verify_lines(lines(result.stdout), [
|
||||
"Tasks:",
|
||||
/\bthree\b\s+Task three/,
|
||||
/\bfour\b\s+Task four/,
|
||||
/--myparam=MYPARAM\s+My special parameter/,
|
||||
/--myp2\s+My parameter 2/,
|
||||
])
|
||||
expect(result.stdout).to_not match /^\s*one\b/
|
||||
expect(result.stdout).to_not match /^\s*two\b/
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user