|
2 | 2 | import time |
3 | 3 |
|
4 | 4 | from mkdocs_include_markdown_plugin.event import on_page_markdown |
5 | | -from testing_helpers import parametrize_directives, unix_only |
| 5 | +from testing_helpers import parametrize_directives, unix_only, windows_only |
6 | 6 |
|
7 | 7 |
|
8 | 8 | @parametrize_directives |
@@ -496,3 +496,43 @@ def test_natural_order_by_extension_reverse(directive, page, tmp_path, plugin): |
496 | 496 | tmp_path, |
497 | 497 | plugin, |
498 | 498 | ) == 'file10.txt\nfile1.md\nfile2.md\n' |
| 499 | + |
| 500 | + |
| 501 | +@parametrize_directives |
| 502 | +@windows_only |
| 503 | +def test_ctime_order(directive, page, tmp_path, plugin): |
| 504 | + f1 = tmp_path / 'file2.md' |
| 505 | + f1.write_text('file2.md\n') |
| 506 | + time.sleep(1) |
| 507 | + f2 = tmp_path / 'file1.md' |
| 508 | + f2.write_text('file1.md\n') |
| 509 | + |
| 510 | + assert on_page_markdown( |
| 511 | + f'''{{% |
| 512 | +{directive} "*.md" |
| 513 | +order='ctime' |
| 514 | +%}}''', |
| 515 | + page(tmp_path / 'includer.md'), |
| 516 | + tmp_path, |
| 517 | + plugin, |
| 518 | + ) == 'file2.md\nfile1.md\n' |
| 519 | + |
| 520 | + |
| 521 | +@windows_only |
| 522 | +@parametrize_directives |
| 523 | +def test_ctime_reverse_order(directive, page, tmp_path, plugin): |
| 524 | + f1 = tmp_path / 'file2.md' |
| 525 | + f1.write_text('file2.md\n') |
| 526 | + time.sleep(1) |
| 527 | + f2 = tmp_path / 'file1.md' |
| 528 | + f2.write_text('file1.md\n') |
| 529 | + |
| 530 | + assert on_page_markdown( |
| 531 | + f'''{{% |
| 532 | +{directive} "*.md" |
| 533 | +order='-ctime' |
| 534 | +%}}''', |
| 535 | + page(tmp_path / 'includer.md'), |
| 536 | + tmp_path, |
| 537 | + plugin, |
| 538 | + ) == 'file1.md\nfile2.md\n' |
0 commit comments