Skip to content

Commit b9cea61

Browse files
author
José Valim
committed
Check if native name encoding is utf8
1 parent bdb4afe commit b9cea61

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

lib/elixir/test/elixir/file_test.exs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ defmodule FileTest do
88
defmodule Cp do
99
use ExUnit.Case
1010

11-
# cp_r/c is managed in setup/teardown because if it is stored in
11+
# cp_r/c is managed in setup/teardown because if it is stored in
1212
# the repository, reltool can't build a release
1313
def setup do
1414
src = fixture_path("cp_r")
@@ -371,7 +371,7 @@ defmodule FileTest do
371371
File.cp! src, dest, fn(_,_) -> true end
372372
File.Stat[mode: src_mode] = File.stat! src
373373
File.Stat[mode: dest_mode] = File.stat! dest
374-
assert src_mode == dest_mode
374+
assert src_mode == dest_mode
375375
end
376376

377377
end
@@ -675,7 +675,7 @@ defmodule FileTest do
675675
defmodule Rm do
676676
use ExUnit.Case
677677

678-
# cp_r/c is managed in setup/teardown because if it is stored in
678+
# cp_r/c is managed in setup/teardown because if it is stored in
679679
# the repository, reltool can't build a release
680680
def setup do
681681
src = fixture_path("cp_r")
@@ -1048,9 +1048,11 @@ defmodule FileTest do
10481048
end
10491049

10501050
test :cwd_and_cd_with_utf8 do
1051-
File.cd!(fixture_path("héllò"), fn ->
1052-
assert Path.basename(File.cwd!) == "héllò"
1053-
end)
1051+
if :file.native_name_encoding == :utf8 do
1052+
File.cd!(fixture_path("héllò"), fn ->
1053+
assert Path.basename(File.cwd!) == "héllò"
1054+
end)
1055+
end
10541056
end
10551057

10561058
test :invalid_cd do

lib/elixir/test/elixir/path_test.exs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ defmodule PathTest do
55

66
test :wildcard do
77
import PathHelpers
8-
assert Path.wildcard(fixture_path("héllò")) == [fixture_path("héllò")]
8+
9+
if :file.native_name_encoding == :utf8 do
10+
assert Path.wildcard(fixture_path("héllò")) == [fixture_path("héllò")]
11+
end
912
end
1013

1114
test :absname_with_binary do

lib/elixir/test/elixir/system_test.exs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ defmodule SystemTest do
2020
test :cwd_with_utf8 do
2121
import PathHelpers
2222

23-
File.cd!(fixture_path("héllò"), fn ->
24-
assert Path.basename(System.cwd!) == "héllò"
25-
end)
23+
if :file.native_name_encoding == :utf8 do
24+
File.cd!(fixture_path("héllò"), fn ->
25+
assert Path.basename(System.cwd!) == "héllò"
26+
end)
27+
end
2628
end
2729

2830
test :user_home do

0 commit comments

Comments
 (0)