summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMengxuan Xia <xiamx2004@gmail.com>2017-05-25 18:50:58 -0400
committerJosé Valim <jose.valim@gmail.com>2017-05-26 00:50:58 +0200
commita8fbcb2e2882a6fc13f97ec45cad250390c93af1 (patch)
tree444c1241b07e4150b5127dfd74e2846fd651dc8b
parentb56cc927f44b48f54da65ce545549974a1045460 (diff)
downloadelixir-a8fbcb2e2882a6fc13f97ec45cad250390c93af1.tar.gz
More work regarding making CI on Windows green (#6150)
-rw-r--r--.appveyor.yml4
-rw-r--r--lib/eex/test/eex_test.exs12
-rw-r--r--lib/mix/test/mix/project_test.exs9
-rw-r--r--lib/mix/test/mix/utils_test.exs25
4 files changed, 37 insertions, 13 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 7f3dbcbb8..0647781ce 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -3,5 +3,7 @@ version: 1-{branch}+{build}
build_script:
- cmd: C:\MinGW\msys\1.0\bin\make
- cmd: rmdir /s /q .git
+before_test:
+ - cmd: set PATH=%PATH%;C:\Program Files\erl8.3\erts-8.3\bin
test_script:
- - cmd: C:\MinGW\msys\1.0\bin\make test \ No newline at end of file
+ - cmd: C:\MinGW\msys\1.0\bin\make --keep-going test
diff --git a/lib/eex/test/eex_test.exs b/lib/eex/test/eex_test.exs
index 52e99d7b4..899ca0505 100644
--- a/lib/eex/test/eex_test.exs
+++ b/lib/eex/test/eex_test.exs
@@ -369,13 +369,13 @@ defmodule EExTest do
test "evaluates the source" do
filename = Path.join(__DIR__, "fixtures/eex_template.eex")
result = EEx.eval_file(filename)
- assert result == "foo bar.\n"
+ assert_normalized_newline_equal "foo bar.\n", result
end
test "evaluates the source with bindings" do
filename = Path.join(__DIR__, "fixtures/eex_template_with_bindings.eex")
result = EEx.eval_file(filename, [bar: 1])
- assert result == "foo 1\n"
+ assert_normalized_newline_equal "foo 1\n", result
end
test "raises an Exception when file is missing" do
@@ -398,8 +398,8 @@ defmodule EExTest do
end
test "from file" do
- assert EExTest.Compiled.file_sample(1) == "foo 1\n"
- assert EExTest.Compiled.public_file_sample(1) == "foo 1\n"
+ assert_normalized_newline_equal "foo 1\n", EExTest.Compiled.file_sample(1)
+ assert_normalized_newline_equal "foo 1\n", EExTest.Compiled.public_file_sample(1)
end
test "from file does not affect backtrace" do
@@ -463,4 +463,8 @@ defmodule EExTest do
result = EEx.eval_string(actual, binding, opts)
assert result == expected
end
+
+ defp assert_normalized_newline_equal(expected, actual) do
+ assert String.replace(expected, "\r\n", "\n") == String.replace(actual, "\r\n", "\n")
+ end
end
diff --git a/lib/mix/test/mix/project_test.exs b/lib/mix/test/mix/project_test.exs
index 699003a23..5c5b11c0c 100644
--- a/lib/mix/test/mix/project_test.exs
+++ b/lib/mix/test/mix/project_test.exs
@@ -138,7 +138,14 @@ defmodule Mix.ProjectTest do
defp assert_proj_dir_linked_or_copied(source, target, symlink_path) do
case :file.read_link(source) do
- {:ok, path} -> assert path == symlink_path
+ {:ok, path} ->
+ case :os.type do
+ # relative symlink on Windows are broken, see symlink_or_copy/2
+ {:win32, _} ->
+ assert path == [source, '..', symlink_path] |> Path.join |> Path.expand |> String.to_charlist
+ _ ->
+ assert path == symlink_path
+ end
{:error, _} -> assert File.ls!(source) == File.ls!(target)
end
end
diff --git a/lib/mix/test/mix/utils_test.exs b/lib/mix/test/mix/utils_test.exs
index ec0033fdf..9c69e0490 100644
--- a/lib/mix/test/mix/utils_test.exs
+++ b/lib/mix/test/mix/utils_test.exs
@@ -64,12 +64,15 @@ defmodule Mix.UtilsTest do
end
end
- test "symlink or copy erases wrong symblinks" do
- in_fixture "archive", fn ->
- File.mkdir_p!("_build/archive")
- Mix.Utils.symlink_or_copy(Path.expand("priv"), Path.expand("_build/archive/ebin"))
- result = Mix.Utils.symlink_or_copy(Path.expand("ebin"), Path.expand("_build/archive/ebin"))
- assert_ebin_symlinked_or_copied(result)
+ @windows? match?({:win32, _}, :os.type)
+ unless @windows? do
+ test "symlink or copy erases wrong symblinks" do
+ in_fixture "archive", fn ->
+ File.mkdir_p!("_build/archive")
+ Mix.Utils.symlink_or_copy(Path.expand("priv"), Path.expand("_build/archive/ebin"))
+ result = Mix.Utils.symlink_or_copy(Path.expand("ebin"), Path.expand("_build/archive/ebin"))
+ assert_ebin_symlinked_or_copied(result)
+ end
end
end
@@ -92,7 +95,15 @@ defmodule Mix.UtilsTest do
defp assert_ebin_symlinked_or_copied(result) do
case result do
{:ok, paths} -> assert Path.expand("_build/archive/ebin") in paths
- :ok -> assert :file.read_link("_build/archive/ebin") == {:ok, '../../ebin'}
+ :ok ->
+ expected_link =
+ case :os.type do
+ # relative symlink on Windows are broken, see symlink_or_copy/2
+ {:win32, _} -> "ebin" |> Path.expand() |> String.to_char_list()
+ _ -> '../../ebin'
+ end
+ {:ok, actual_link} = :file.read_link("_build/archive/ebin")
+ assert actual_link == expected_link
_ -> flunk "expected symlink_or_copy to return :ok or {:ok, list_of_paths}, got: #{inspect result}"
end
end