From 7adee6d62fabae0244d611069f09ab906a459805 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Fri, 1 Dec 2017 15:00:27 -0800 Subject: Utils.popen_read: Nonexistent program should fail Ensure that $CHILD_STATUS.success? is false when the command does not exist. --- Library/Homebrew/test/utils/popen_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Library/Homebrew/test') diff --git a/Library/Homebrew/test/utils/popen_spec.rb b/Library/Homebrew/test/utils/popen_spec.rb index 63bbc7b18..d1ae12d1c 100644 --- a/Library/Homebrew/test/utils/popen_spec.rb +++ b/Library/Homebrew/test/utils/popen_spec.rb @@ -15,6 +15,12 @@ describe Utils do ).to eq("success") expect($CHILD_STATUS).to be_a_success end + + it "fails when the command does not exist" do + expect(subject.popen_read("./nonexistent", err: :out)) + .to eq("brew: command not found: ./nonexistent\n") + expect($CHILD_STATUS).to be_a_failure + end end describe "::popen_write" do -- cgit v1.2.3