diff options
author | vitya-smirnov <[email protected]> | 2025-07-30 11:26:26 +0300 |
---|---|---|
committer | vitya-smirnov <[email protected]> | 2025-07-30 11:38:37 +0300 |
commit | cf9f591e5c90bf964bb922c0f6c3716045972b02 (patch) | |
tree | 36d4eb0816606653836399ac32ea58d2eca08b53 /yql/essentials/utils/docs/markdown_ut.cpp | |
parent | ada885655c2e21f6b55e2d3d724e57c9a1fdb843 (diff) |
YQL-20112: Improve dramatically yql/utils/docs
Introduced `links.json` format to link names to
documentation sections. Implement general links
verification framework. Also fixed two small typos.
Extended Description: https://nda.ya.ru/t/zR4voivb7GzD9r.
commit_hash:e72db0e202b4ff612374c73fa384f70d029f0ef0
Diffstat (limited to 'yql/essentials/utils/docs/markdown_ut.cpp')
-rw-r--r-- | yql/essentials/utils/docs/markdown_ut.cpp | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/yql/essentials/utils/docs/markdown_ut.cpp b/yql/essentials/utils/docs/markdown_ut.cpp index 15d69ed9e5d..8cafa2f22f1 100644 --- a/yql/essentials/utils/docs/markdown_ut.cpp +++ b/yql/essentials/utils/docs/markdown_ut.cpp @@ -2,7 +2,7 @@ #include <library/cpp/testing/unittest/registar.h> -using namespace NSQLComplete; +using namespace NYql::NDocs; Y_UNIT_TEST_SUITE(MarkdownParserTests) { @@ -51,26 +51,23 @@ SELECT FROM my_table; ``` )"; - TVector<TMarkdownSection> sections; - - TStringStream input(markdown); - ParseMarkdown(input, [&](TMarkdownSection&& section) { - sections.emplace_back(std::move(section)); - }); - - UNIT_ASSERT_VALUES_EQUAL(sections.size(), 2); - - UNIT_ASSERT_STRING_CONTAINS(sections[0].Header.Content, "COALESCE"); - UNIT_ASSERT_VALUES_EQUAL(sections[0].Header.Anchor, "#coalesce"); - UNIT_ASSERT_STRING_CONTAINS(sections[0].Body, "Iterates"); - UNIT_ASSERT_STRING_CONTAINS(sections[0].Body, "COALESCE"); - UNIT_ASSERT_GE(Count(sections[0].Body, '\n'), 5); - - UNIT_ASSERT_STRING_CONTAINS(sections[1].Header.Content, "Random"); - UNIT_ASSERT_VALUES_EQUAL(sections[1].Header.Anchor, "#random"); - UNIT_ASSERT_STRING_CONTAINS(sections[1].Body, "Generates"); - UNIT_ASSERT_STRING_CONTAINS(sections[1].Body, "Random"); - UNIT_ASSERT_GE(Count(sections[1].Body, '\n'), 5); + TMarkdownPage page = ParseMarkdownPage(markdown); + + UNIT_ASSERT_VALUES_EQUAL(page.SectionsByAnchor.size(), 2); + + const auto& coelcese = page.SectionsByAnchor["coalesce"]; + UNIT_ASSERT_STRING_CONTAINS(coelcese.Header.Content, "COALESCE"); + UNIT_ASSERT_VALUES_EQUAL(coelcese.Header.Anchor, "coalesce"); + UNIT_ASSERT_STRING_CONTAINS(coelcese.Body, "Iterates"); + UNIT_ASSERT_STRING_CONTAINS(coelcese.Body, "COALESCE"); + UNIT_ASSERT_GE(Count(coelcese.Body, '\n'), 5); + + const auto& random = page.SectionsByAnchor["random"]; + UNIT_ASSERT_STRING_CONTAINS(random.Header.Content, "Random"); + UNIT_ASSERT_VALUES_EQUAL(random.Header.Anchor, "random"); + UNIT_ASSERT_STRING_CONTAINS(random.Body, "Generates"); + UNIT_ASSERT_STRING_CONTAINS(random.Body, "Random"); + UNIT_ASSERT_GE(Count(random.Body, '\n'), 5); } } // Y_UNIT_TEST_SUITE(MarkdownParserTests) |