-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix flaky test relying on application env
- Loading branch information
Showing
2 changed files
with
24 additions
and
18 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
test/makeup/lexers/elixir_lexer/elixir_lexer_sigil_lexer_test.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
defmodule ElixirLexerSigilLexerTest do | ||
use ExUnit.Case, async: false | ||
import Makeup.Lexers.ElixirLexer.Testing, only: [lex: 1] | ||
|
||
describe "custom lexers for sigils" do | ||
test "can register a custom lexer" do | ||
defmodule MyCustomLexer do | ||
def lex(input) do | ||
[{:keyword, %{}, input}] | ||
end | ||
end | ||
|
||
Makeup.Lexers.ElixirLexer.register_sigil_lexer("H", MyCustomLexer) | ||
|
||
assert lex("~H|Hello, world!|") == [ | ||
{:string_sigil, %{}, "~H|"}, | ||
{:keyword, %{}, "Hello, world!"}, | ||
{:string_sigil, %{}, "|"} | ||
] | ||
after | ||
Application.put_env(:makeup_elixir, :sigil_lexers, %{}) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters