Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
José Valim
committed
May 31, 2012
1 parent
9947f6a
commit c926b7f
Showing
3 changed files
with
47 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Code.require_file "../../test_helper", __FILE__ | ||
|
||
defmodule Kernel.AliasTest.Nested do | ||
def value, do: 1 | ||
end | ||
|
||
defmodule Kernel.AliasTest do | ||
alias Kernel.AliasTest.Nested, as: Nested | ||
|
||
use ExUnit.Case | ||
|
||
test :alias_erlang do | ||
alias Erlang.lists, as: MyList | ||
assert MyList.flatten([1,[2],3]) == [1,2,3] | ||
assert __MAIN__.MyList.Bar == :"__MAIN__.MyList.Bar" | ||
assert MyList.Bar == :"__MAIN__.lists.Bar" | ||
end | ||
|
||
test :double_alias do | ||
alias Kernel.AliasTest.Nested, as: Nested2 | ||
assert Nested.value == 1 | ||
assert Nested2.value == 1 | ||
end | ||
|
||
test :overwriten_alias do | ||
alias List, as: Nested | ||
assert Nested.flatten([[13]]) == [13] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters