tests: fix external command test and code style (#281)
The check that `t4` is not an external command would always succeed, but not because the file wasn't executable, but because it wasn't even found due to the missing `brew-` prefix. Also change the valid but atypical file mode from 0744 to 0755 and apply minor code style fixes.
This commit is contained in:
parent
aa747b915a
commit
78f8c60343
@ -19,7 +19,7 @@ class CommandsTests < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
@cmds.each { |f| f.unlink }
|
@cmds.each(&:unlink)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_internal_commands
|
def test_internal_commands
|
||||||
@ -43,12 +43,12 @@ class CommandsTests < Homebrew::TestCase
|
|||||||
%w[brew-t1 brew-t2.rb brew-t3.py].each do |file|
|
%w[brew-t1 brew-t2.rb brew-t3.py].each do |file|
|
||||||
path = "#{dir}/#{file}"
|
path = "#{dir}/#{file}"
|
||||||
FileUtils.touch path
|
FileUtils.touch path
|
||||||
FileUtils.chmod 0744, path
|
FileUtils.chmod 0755, path
|
||||||
end
|
end
|
||||||
|
|
||||||
FileUtils.touch "#{dir}/t4"
|
FileUtils.touch "#{dir}/brew-t4"
|
||||||
|
|
||||||
ENV["PATH"] = "#{ENV["PATH"]}#{File::PATH_SEPARATOR}#{dir}"
|
ENV["PATH"] += "#{File::PATH_SEPARATOR}#{dir}"
|
||||||
cmds = Homebrew.external_commands
|
cmds = Homebrew.external_commands
|
||||||
|
|
||||||
assert cmds.include?("t1"), "Executable files should be included"
|
assert cmds.include?("t1"), "Executable files should be included"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user