Revert "Do not expand prepend and append paths"

This reverts commit 20d96a0d77.
This commit is contained in:
José Valim
2012-07-23 21:56:48 +02:00
parent bdbc9f38e0
commit fa449e842a
2 changed files with 27 additions and 2 deletions
+2 -2
View File
@@ -94,12 +94,12 @@ defmodule Kernel.CLI do
end
defp process_shared(['-pa',h|t], config) do
Code.prepend_path h
Enum.each File.wildcard(File.expand_path(h)), Code.prepend_path(&1)
process_shared t, config
end
defp process_shared(['-pz',h|t], config) do
Code.append_path(h)
Enum.each File.wildcard(File.expand_path(h)), Code.append_path(&1)
process_shared t, config
end
@@ -12,6 +12,31 @@ defmodule Kernel.CLI.InitTest do
end
end
defmodule Kernel.CLI.OptionParsingTest do
use ExUnit.Case, async: true
import PathHelpers
test :path do
root = fixture_path("../../..") /> to_char_list
list = elixir('-e "IO.inspect Erlang.code.get_path" -pa "#{root}/*" -pz "#{root}/lib/*"')
{ path, _ } = Code.eval list, []
# pa
assert File.expand_path('ebin', root) in path
assert File.expand_path('lib', root) in path
assert File.expand_path('src', root) in path
# pz
assert File.expand_path('lib/list', root) in path
end
test :require do
options = ['-r', fixture_path('../../../lib/list/*') /> to_char_list, '-r', '/never/gonna/*/up']
{ config, _argv } = Kernel.CLI.process_options(options, Kernel.CLI.Config.new)
assert {:require, fixture_path "../../../lib/list/chars.ex"} in config.commands
end
end
defmodule Kernel.CLI.AtExitTest do
use ExUnit.Case, async: true
import PathHelpers