mirror of
https://github.com/Hopiu/djLint.git
synced 2026-04-02 05:30:24 +00:00
parent
4906fbc525
commit
e906b3e30a
2 changed files with 15 additions and 1 deletions
|
|
@ -128,7 +128,7 @@ def main(
|
|||
temp_file = None
|
||||
|
||||
if "-" in src:
|
||||
stdin_stream = click.get_text_stream("stdin")
|
||||
stdin_stream = click.get_text_stream("stdin", encoding="utf8")
|
||||
stdin_text = stdin_stream.read()
|
||||
|
||||
temp_file = tempfile.NamedTemporaryFile(delete=False)
|
||||
|
|
|
|||
|
|
@ -120,6 +120,20 @@ def test_stdin(runner: CliRunner) -> None:
|
|||
assert result.output == "<div></div>\n"
|
||||
|
||||
|
||||
def test_stdin_non_ascii(runner: CliRunner) -> None:
|
||||
result = runner.invoke(djlint, ["-", "--reformat"], input="必須")
|
||||
assert result.output == "必須\n"
|
||||
|
||||
result = runner.invoke(djlint, ["-", "--reformat"], input="Вход")
|
||||
assert result.output == "Вход\n"
|
||||
|
||||
result = runner.invoke(djlint, ["-", "--reformat"], input="çéâêîôûàèìòùëïü")
|
||||
assert result.output == "çéâêîôûàèìòùëïü\n"
|
||||
|
||||
result = runner.invoke(djlint, ["-", "--reformat"], input="😀😂🤣😆🥰")
|
||||
assert result.output == "😀😂🤣😆🥰\n"
|
||||
|
||||
|
||||
def test_check(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||
write_to_file(tmp_file.name, b"<div></div>")
|
||||
result = runner.invoke(djlint, [tmp_file.name, "--check"])
|
||||
|
|
|
|||
Loading…
Reference in a new issue