Test Your Knowledge!

Take this quiz to test what you've learned in this chapter.

Quiz on testing macros.

1

Take the following module as reference:

defmodule I18n do
  use Translator

  locale "en",
    flash: [
      hello: "Hello %{first} %{last}!",
      bye: "Bye, %{name}!"
    ],
    users: [
      name: "Ronald",
    ]
  locale "fr",
    flash: [
      hello: "Salut %{first} %{last}!",
    ],
    users: [
      name: "Ronald",
    ]

Which test case could be used to check if hello is translated correctly in fr?

A)
test "Hello in French" do
assert I18n.t("en", "flash.hello", first: "John", last: "Smith") ==
    "hello John Smith!"
end
B)
test "Hello in French" do
assert I18n.t("fr", "flash.notice.hello", first: "Jason", last: "S") ==
    "Salut Jason S!"
end
C)
test "Hello in French" do
assert I18n.t("fr", "flash.notice.hello", name: "John S") ==
    "hello Jason S!"
end
Question 1 of 60 attempted

Get hands-on with 1300+ tech skills courses.