Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 55 additions & 22 deletions exercises/practice/dot-dsl/test/dot_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ defmodule DotTest do
end

@tag :pending
test "graph with just attribute" do
test "graph with one attribute" do
assert %Graph{attrs: %{foo: 1}} ==
exprt(
Dot.graph do
Expand All @@ -67,7 +67,7 @@ defmodule DotTest do
end

@tag :pending
test "graph with attrs" do
test "graph with many attributes, nodes, and edges" do
assert %Graph{
attrs: %{bar: true, foo: 1, title: "Testing Attrs"},
nodes: %{a: %{color: :green}, b: %{label: "Beta!"}, c: %{}},
Expand All @@ -89,107 +89,107 @@ defmodule DotTest do
end

@tag :pending
test "keywords stuck to graph without space" do
test "invalid graph attribute syntax: wrong argument type" do
assert_raise ArgumentError, fn ->
exprt(
Dot.graph do
graph[[title: "Bad"]]
graph("Bad")
end
)
end
end

@tag :pending
test "keywords stuck to node without space" do
test "invalid graph attribute syntax: not a call" do
assert_raise ArgumentError, fn ->
exprt(
Dot.graph do
a[[label: "Alpha!"]]
graph[title: "Bad"]
end
)
end
end

@tag :pending
test "keywords stuck to edge without space" do
test "invalid node syntax: numerical node name" do
assert_raise ArgumentError, fn ->
exprt(
Dot.graph do
a -- b[[label: "Bad"]]
a
2
end
)
end
end

@tag :pending
test "invalid statement: int" do
test "invalid node syntax: wrong argument type" do
assert_raise ArgumentError, fn ->
exprt(
Dot.graph do
a
2
a("Alpha!")
end
)
end
end

@tag :pending
test "invalid statement: list" do
test "invalid node syntax: not a call" do
assert_raise ArgumentError, fn ->
exprt(
Dot.graph do
[title: "Testing invalid"]
a[label: "Alpha!"]
end
)
end
end

@tag :pending
test "invalid statement: qualified atom" do
test "invalid node syntax: two attribute lists" do
assert_raise ArgumentError, fn ->
exprt(
Dot.graph do
Enum.map()
a([color: green], label: "Alpha!")
end
)
end
end

@tag :pending
test "invalid statement: graph with no keywords" do
test "invalid node syntax: non-keyword attribute list" do
assert_raise ArgumentError, fn ->
exprt(
Dot.graph do
Enum.map()
a(["Alpha!", color: green])
end
)
end
end

@tag :pending
test "two attribute lists" do
test "invalid edge syntax: wrong argument type" do
assert_raise ArgumentError, fn ->
exprt(
Dot.graph do
a([color: green][[label: "Alpha!"]])
a -- b("Bad")
end
)
end
end

@tag :pending
test "non-keyword attribute list" do
test "invalid edge syntax: not a call" do
assert_raise ArgumentError, fn ->
exprt(
Dot.graph do
a(["Alpha!", color: green])
a -- b[label: "Bad"]
end
)
end
end

@tag :pending
test "int edge" do
test "invalid edge syntax: numerical node names" do
assert_raise ArgumentError, fn ->
exprt(
Dot.graph do
Expand All @@ -206,4 +206,37 @@ defmodule DotTest do
)
end
end

@tag :pending
test "invalid statement: keyword list" do
assert_raise ArgumentError, fn ->
exprt(
Dot.graph do
[title: "Testing invalid"]
end
)
end
end

@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
graph()
end
)
end
end
end
Loading