Fix regression in RDF.LangString.match_language?/2

This commit is contained in:
Marcel Otto 2020-05-17 02:47:48 +02:00
parent 47a19c0a67
commit 5daf32446d
2 changed files with 2 additions and 1 deletions

View file

@ -126,7 +126,7 @@ defmodule RDF.LangString do
do: match_language?(language_tag, language_range)
def match_language?("", "*"), do: false
def match_language?(_, "*"), do: true
def match_language?(str, "*") when is_binary(str), do: true
def match_language?(language_tag, language_range)
when is_binary(language_tag) and is_binary(language_range) do

View file

@ -291,6 +291,7 @@ defmodule RDF.LangStringTest do
test "with a non-language-tagged literal" do
refute XSD.String.new("42") |> LangString.match_language?("de")
refute XSD.String.new("42") |> LangString.match_language?("")
refute XSD.String.new("42") |> LangString.match_language?("*")
refute XSD.Integer.new("42") |> LangString.match_language?("de")
end
end