Format code with Elixir 1.12
This commit is contained in:
parent
fc6ee4555f
commit
3b16a76ccd
12 changed files with 18 additions and 54 deletions
|
@ -40,9 +40,7 @@ defimpl Inspect, for: RDF.Description do
|
|||
caught_exception ->
|
||||
message =
|
||||
"got #{inspect(caught_exception.__struct__)} with message " <>
|
||||
"#{inspect(Exception.message(caught_exception))} while inspecting RDF.Description #{
|
||||
description.subject
|
||||
}"
|
||||
"#{inspect(Exception.message(caught_exception))} while inspecting RDF.Description #{description.subject}"
|
||||
|
||||
exception = Inspect.Error.exception(message: message)
|
||||
|
||||
|
@ -87,9 +85,7 @@ defimpl Inspect, for: RDF.Graph do
|
|||
caught_exception ->
|
||||
message =
|
||||
"got #{inspect(caught_exception.__struct__)} with message " <>
|
||||
"#{inspect(Exception.message(caught_exception))} while inspecting RDF.Graph #{
|
||||
graph.name
|
||||
}"
|
||||
"#{inspect(Exception.message(caught_exception))} while inspecting RDF.Graph #{graph.name}"
|
||||
|
||||
exception = Inspect.Error.exception(message: message)
|
||||
|
||||
|
|
|
@ -53,9 +53,7 @@ defmodule RDF.Literal.Generic do
|
|||
literal
|
||||
else
|
||||
raise ArgumentError,
|
||||
"#{inspect(value)} with datatype #{inspect(literal.literal.datatype)} is not a valid #{
|
||||
inspect(__MODULE__)
|
||||
}"
|
||||
"#{inspect(value)} with datatype #{inspect(literal.literal.datatype)} is not a valid #{inspect(__MODULE__)}"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -54,9 +54,7 @@ defmodule RDF.LangString do
|
|||
literal
|
||||
else
|
||||
raise ArgumentError,
|
||||
"#{inspect(value)} with language #{inspect(literal.literal.language)} is not a valid #{
|
||||
inspect(__MODULE__)
|
||||
}"
|
||||
"#{inspect(value)} with language #{inspect(literal.literal.language)} is not a valid #{inspect(__MODULE__)}"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -39,15 +39,11 @@ defmodule RDF.NQuads.Decoder do
|
|||
else
|
||||
{:error, {error_line, :ntriples_lexer, error_descriptor}, _error_line_again} ->
|
||||
{:error,
|
||||
"N-Quad scanner error#{if error_with_line_number, do: " on line #{error_line}"}: #{
|
||||
error_description(error_descriptor)
|
||||
}"}
|
||||
"N-Quad scanner error#{if error_with_line_number, do: " on line #{error_line}"}: #{error_description(error_descriptor)}"}
|
||||
|
||||
{:error, {error_line, :nquads_parser, error_descriptor}} ->
|
||||
{:error,
|
||||
"N-Quad parser error#{if error_with_line_number, do: " on line #{error_line}"}: #{
|
||||
error_description(error_descriptor)
|
||||
}"}
|
||||
"N-Quad parser error#{if error_with_line_number, do: " on line #{error_line}"}: #{error_description(error_descriptor)}"}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -39,15 +39,11 @@ defmodule RDF.NTriples.Decoder do
|
|||
else
|
||||
{:error, {error_line, :ntriples_lexer, error_descriptor}, _error_line_again} ->
|
||||
{:error,
|
||||
"N-Triple scanner error#{if error_with_line_number, do: " on line #{error_line}"}: #{
|
||||
error_description(error_descriptor)
|
||||
}"}
|
||||
"N-Triple scanner error#{if error_with_line_number, do: " on line #{error_line}"}: #{error_description(error_descriptor)}"}
|
||||
|
||||
{:error, {error_line, :ntriples_parser, error_descriptor}} ->
|
||||
{:error,
|
||||
"N-Triple parser error#{if error_with_line_number, do: " on line #{error_line}"}: #{
|
||||
error_description(error_descriptor)
|
||||
}"}
|
||||
"N-Triple parser error#{if error_with_line_number, do: " on line #{error_line}"}: #{error_description(error_descriptor)}"}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -391,9 +391,7 @@ defmodule RDF.Turtle.Encoder do
|
|||
defp based_name(_, _), do: nil
|
||||
|
||||
defp typed_literal_term(%Literal{} = literal, state, nesting) do
|
||||
~s["#{Literal.lexical(literal)}"^^#{
|
||||
literal |> Literal.datatype_id() |> term(state, :datatype, nesting)
|
||||
}]
|
||||
~s["#{Literal.lexical(literal)}"^^#{literal |> Literal.datatype_id() |> term(state, :datatype, nesting)}]
|
||||
end
|
||||
|
||||
def prefixed_name(iri, prefixes) do
|
||||
|
|
|
@ -455,9 +455,7 @@ defmodule RDF.XSD.Datatype do
|
|||
@datatype_name datatype_name
|
||||
|
||||
def inspect(literal, _opts) do
|
||||
"%#{@datatype_name}{value: #{inspect(literal.value)}, lexical: #{
|
||||
literal |> literal.__struct__.lexical() |> inspect()
|
||||
}}"
|
||||
"%#{@datatype_name}{value: #{inspect(literal.value)}, lexical: #{literal |> literal.__struct__.lexical() |> inspect()}}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -275,9 +275,7 @@ defmodule RDF.XSD.Datatype.Test.Case do
|
|||
|
||||
Enum.each(@valid, fn {input, {_, _, canonicalized}} ->
|
||||
@tag example: %{input: input, canonicalized: canonicalized}
|
||||
test "lexical of canonicalized #{unquote(datatype)} #{inspect(input, limit: 4)} is #{
|
||||
inspect(canonicalized, limit: 4)
|
||||
}",
|
||||
test "lexical of canonicalized #{unquote(datatype)} #{inspect(input, limit: 4)} is #{inspect(canonicalized, limit: 4)}",
|
||||
%{example: example} do
|
||||
assert unquote(datatype).new(example.input)
|
||||
|> unquote(datatype).canonical()
|
||||
|
|
|
@ -265,18 +265,14 @@ defmodule RDF.LangStringTest do
|
|||
test "with a language tag and a matching non-'*' language range" do
|
||||
Enum.each(@positive_examples, fn {language_tag, language_range} ->
|
||||
assert LangString.match_language?(language_tag, language_range),
|
||||
"expected language range #{inspect(language_range)} to match language tag #{
|
||||
inspect(language_tag)
|
||||
}, but it didn't"
|
||||
"expected language range #{inspect(language_range)} to match language tag #{inspect(language_tag)}, but it didn't"
|
||||
end)
|
||||
end
|
||||
|
||||
test "with a language tag and a non-matching non-'*' language range" do
|
||||
Enum.each(@negative_examples, fn {language_tag, language_range} ->
|
||||
refute LangString.match_language?(language_tag, language_range),
|
||||
"expected language range #{inspect(language_range)} to not match language tag #{
|
||||
inspect(language_tag)
|
||||
}, but it did"
|
||||
"expected language range #{inspect(language_range)} to not match language tag #{inspect(language_tag)}, but it did"
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -308,9 +304,7 @@ defmodule RDF.LangStringTest do
|
|||
literal = LangString.new("foo", language: language_tag)
|
||||
|
||||
refute LangString.match_language?(literal, language_range),
|
||||
"expected language range #{inspect(language_range)} to not match #{
|
||||
inspect(literal)
|
||||
}, but it did"
|
||||
"expected language range #{inspect(language_range)} to not match #{inspect(literal)}, but it did"
|
||||
end)
|
||||
|
||||
refute LangString.match_language?(LangString.new("foo", language: ""), "de")
|
||||
|
|
|
@ -511,9 +511,7 @@ defmodule RDF.LiteralTest do
|
|||
result = Literal.matches?(literal, pattern)
|
||||
|
||||
assert result == expected_result,
|
||||
"expected RDF.Literal.matches?(#{inspect(literal)}, #{inspect(pattern)}) to return #{
|
||||
inspect(expected_result)
|
||||
}, but got #{result}"
|
||||
"expected RDF.Literal.matches?(#{inspect(literal)}, #{inspect(pattern)}) to return #{inspect(expected_result)}, but got #{result}"
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
@ -210,9 +210,7 @@ defmodule RDF.XSD.BooleanTest do
|
|||
]
|
||||
|> Enum.each(fn {left, right, result} ->
|
||||
assert XSD.Boolean.logical_and(left, right) == result,
|
||||
"expected logical_and(#{inspect(left)}, #{inspect(right)}) to be #{inspect(result)}, but got #{
|
||||
inspect(XSD.Boolean.logical_and(left, right))
|
||||
}"
|
||||
"expected logical_and(#{inspect(left)}, #{inspect(right)}) to be #{inspect(result)}, but got #{inspect(XSD.Boolean.logical_and(left, right))}"
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -230,9 +228,7 @@ defmodule RDF.XSD.BooleanTest do
|
|||
]
|
||||
|> Enum.each(fn {left, right, result} ->
|
||||
assert XSD.Boolean.logical_or(left, right) == result,
|
||||
"expected logical_or(#{inspect(left)}, #{inspect(right)}) to be #{inspect(result)}, but got #{
|
||||
inspect(XSD.Boolean.logical_and(left, right))
|
||||
}"
|
||||
"expected logical_or(#{inspect(left)}, #{inspect(right)}) to be #{inspect(result)}, but got #{inspect(XSD.Boolean.logical_and(left, right))}"
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,9 +32,7 @@ defmodule RDF.XSD.Utils.RegexTest do
|
|||
result = Regex.matches?(literal, pattern)
|
||||
|
||||
assert result == expected_result,
|
||||
"expected XSD.Regex.matches?(#{inspect(literal)}, #{inspect(pattern)}) to return #{
|
||||
inspect(expected_result)
|
||||
}, but got #{result}"
|
||||
"expected XSD.Regex.matches?(#{inspect(literal)}, #{inspect(pattern)}) to return #{inspect(expected_result)}, but got #{result}"
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue