diff options
author | Eric Meadows-Jönsson <eric.meadows.jonsson@gmail.com> | 2014-05-08 13:30:46 +0200 |
---|---|---|
committer | Eric Meadows-Jönsson <eric.meadows.jonsson@gmail.com> | 2014-05-08 13:30:46 +0200 |
commit | a9b2a95011928207d23edbfeb3ddb073c73ccda1 (patch) | |
tree | 63f726b8b93253f4876c1bcc8b9848ff30aacf5a /lib/elixir/test/elixir/record_test.exs | |
parent | 86bafe865c8970fd5a8481bc214ed8e28c0684b4 (diff) | |
download | elixir-a9b2a95011928207d23edbfeb3ddb073c73ccda1.tar.gz |
Allow records without field default values
Diffstat (limited to 'lib/elixir/test/elixir/record_test.exs')
-rw-r--r-- | lib/elixir/test/elixir/record_test.exs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/elixir/test/elixir/record_test.exs b/lib/elixir/test/elixir/record_test.exs index 40e1e8474..4916b01d5 100644 --- a/lib/elixir/test/elixir/record_test.exs +++ b/lib/elixir/test/elixir/record_test.exs @@ -50,6 +50,7 @@ defmodule RecordTest do refute record?(13) end + Record.defrecord :timestamp, [:date, :time] Record.defrecord :user, __MODULE__, name: "José", age: 25 Record.defrecordp :file_info, Record.extract(:file_info, from_lib: "kernel/include/file.hrl") @@ -81,4 +82,14 @@ defmodule RecordTest do assert macro_exported?(__MODULE__, :user, 0) refute macro_exported?(__MODULE__, :file_info, 1) end + + test "records with no defaults" do + record = timestamp() + assert timestamp(record, :date) == nil + assert timestamp(record, :time) == nil + + record = timestamp(date: :foo, time: :bar) + assert timestamp(record, :date) == :foo + assert timestamp(record, :time) == :bar + end end |