Dot DSL duplicate test

While doing this exercise in Elixir, I noticed that there are two identical tests with different names. Does anyone know if this is intentional or not?

@tag :pending
test “invalid statement: qualified atom” do
assert_raise ArgumentError, fn →
exprt(
Dot.graph do
Enum.map()
end
)
end
end

@tag :pending
test “invalid statement: graph with no keywords” do
assert_raise ArgumentError, fn →
exprt(
Dot.graph do
Enum.map()
end
)
end
end

The exercise is already quite difficult, I think I need a separate degree just to write, understand and use AST or anything else related to metaprogramming correctly.
Am I the only one in this situation?

Hi! Thank you for this report.

You are absolutely right that there’s something weird about the tests for this exercise.

This exercise was created 12 (!) years ago. During that time, the repository of Elixir exercises went through many changes, for example autoformatting all code, which slightly changed the meaning of some of the tests. E.g. somehow graph[title: "Bad"] got automatically turned into graph[[title: "Bad"]].

The two identical tests you mentioned are a mistake that has been there since the very beginning :scream: I think the second test, “graph with no keywords”, is supposed to test for a graph with a call to graph().

I’ll take a closer look at the test suite and try to fix some of the most obvious problems.

A yes, this exercise is very difficult and you are not the only one struggling with metaprogramming in Elixir :wink: I too had a very hard time learning it.

2 Likes

This is the PR with my changes: Refactor dot-dsl tests by angelikatyborska · Pull Request #1588 · exercism/elixir · GitHub