Skip to content
This repository has been archived by the owner on Apr 12, 2019. It is now read-only.

Commit

Permalink
List#append, wrapping erl.lists.append()
Browse files Browse the repository at this point in the history
  • Loading branch information
practicingruby committed Nov 20, 2010
1 parent 8d2b01e commit b33c65a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/builtins/list.re
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ class List
def join
join("")
end

# Returns a new list built by concatenating the two lists together to
# produce a third list.
def append(other_list)
erl.lists.append(self, other_list)
end

# Iterate over a list, successively calling the given block and returning
# the receiver when done
Expand Down
8 changes: 8 additions & 0 deletions test/builtins/list_test.re
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module ListTest
complex_replace_test(),
reverse_test(),
join_test(),
append_test(),
each_test(),
map_test(),
all_test(),
Expand Down Expand Up @@ -87,6 +88,13 @@ module ListTest
("1,2,3", [1,2,3].join(','))
end
end

# concatenates two lists together to form a third list
def append_test
TestHelper.expect(List, "is concatenated with another list") do
([1,2,3,4,5,6], [1,2,3].append([4,5,6]))
end
end

# iterates each element
def each_test
Expand Down

0 comments on commit b33c65a

Please sign in to comment.