generated from executablebooks/mdformat-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: expand unit tests based on mdformat-admon
- Loading branch information
Showing
7 changed files
with
75 additions
and
30 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
Empty file.
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,47 @@ | ||
2023 Syntax | ||
. | ||
> [!NOTE] | ||
> Useful information that users should know, even when skimming content. | ||
> [!TIP] | ||
> Helpful advice for doing things better or more easily. | ||
> [!IMPORTANT] | ||
> Key information users need to know to achieve their goal. | ||
> [!WARNING] | ||
> Urgent info that needs immediate user attention to avoid problems. | ||
> [!CAUTION] | ||
> Advises about risks or negative outcomes of certain actions. | ||
. | ||
> [!NOTE] | ||
> Useful information that users should know, even when skimming content. | ||
> [!TIP] | ||
> Helpful advice for doing things better or more easily. | ||
> [!IMPORTANT] | ||
> Key information users need to know to achieve their goal. | ||
> [!WARNING] | ||
> Urgent info that needs immediate user attention to avoid problems. | ||
> [!CAUTION] | ||
> Advises about risks or negative outcomes of certain actions. | ||
. | ||
|
||
2022 (to 2023) Syntax | ||
. | ||
> **Note** | ||
> This is a note | ||
> **Warning** | ||
> This is a warning | ||
. | ||
> [!NOTE] | ||
> This is a note | ||
> [!WARNING] | ||
> This is a warning | ||
. |
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 |
---|---|---|
@@ -1,17 +1,21 @@ | ||
from pathlib import Path | ||
|
||
from markdown_it.utils import read_fixture_file | ||
import mdformat | ||
import pytest | ||
from markdown_it.utils import read_fixture_file | ||
|
||
from ..helpers import print_text | ||
|
||
FIXTURE_PATH = Path(__file__).parent / "fixtures.md" | ||
fixtures = read_fixture_file(FIXTURE_PATH) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"line,title,text,expected", fixtures, ids=[f[1] for f in fixtures] | ||
("line", "title", "text", "expected"), | ||
fixtures, | ||
ids=[f[1] for f in fixtures], | ||
) | ||
def test_fixtures(line, title, text, expected): | ||
output = mdformat.text(text, extensions={"plugin"}) | ||
print(output) | ||
assert output.rstrip() == expected.rstrip(), output | ||
output = mdformat.text(text, extensions={"gfm_alerts"}) | ||
print_text(output, expected) | ||
assert output.rstrip() == expected.rstrip() |
Empty file.
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,18 @@ | ||
from pathlib import Path | ||
|
||
import mdformat | ||
|
||
|
||
def test_mdformat_text(): | ||
"""Verify that using mdformat works as expected.""" | ||
content = (Path(__file__).parent / "pre-commit-test.md").read_text() | ||
|
||
result = mdformat.text( | ||
content, | ||
options={"end-of-line": "keep"}, | ||
extensions={ | ||
"gfm_alerts", | ||
}, | ||
) | ||
|
||
assert result == content |