mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-25 19:35:06 +00:00
13 lines
No EOL
9.3 KiB
HTML
13 lines
No EOL
9.3 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Assorted testing utilities."><title>test_utils - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="test_utils" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../test_utils/index.html">test_<wbr>utils</a><span class="version">0.0.0</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#macros" title="Macros">Macros</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>test_utils</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/test_utils/lib.rs.html#1-501">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Assorted testing utilities.</p>
|
|
<p>Most notable things are:</p>
|
|
<ul>
|
|
<li>Rich text comparison, which outputs a diff.</li>
|
|
<li>Extracting markup (mainly, <code>$0</code> markers) out of fixture strings.</li>
|
|
<li>marks (see the eponymous module).</li>
|
|
</ul>
|
|
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="bench_fixture/index.html" title="mod test_utils::bench_fixture">bench_<wbr>fixture</a></div><div class="desc docblock-short">Generates large snippets of Rust code for usage in the benchmarks.</div></li></ul><h2 id="macros" class="section-header">Macros<a href="#macros" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="macro" href="macro.assert_eq_text.html" title="macro test_utils::assert_eq_text">assert_<wbr>eq_<wbr>text</a></div><div class="desc docblock-short">Asserts that two strings are equal, otherwise displays a rich diff between them.</div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.AssertLinear.html" title="struct test_utils::AssertLinear">Assert<wbr>Linear</a></div></li><li><div class="item-name"><a class="struct" href="struct.Fixture.html" title="struct test_utils::Fixture">Fixture</a></div></li><li><div class="item-name"><a class="struct" href="struct.FixtureWithProjectMeta.html" title="struct test_utils::FixtureWithProjectMeta">Fixture<wbr>With<wbr>Project<wbr>Meta</a></div></li><li><div class="item-name"><a class="struct" href="struct.MiniCore.html" title="struct test_utils::MiniCore">Mini<wbr>Core</a></div></li></ul><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.RangeOrOffset.html" title="enum test_utils::RangeOrOffset">Range<wbr>OrOffset</a></div></li></ul><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="constant" href="constant.CURSOR_MARKER.html" title="constant test_utils::CURSOR_MARKER">CURSOR_<wbr>MARKER</a></div></li><li><div class="item-name"><a class="constant" href="constant.ESCAPED_CURSOR_MARKER.html" title="constant test_utils::ESCAPED_CURSOR_MARKER">ESCAPED_<wbr>CURSOR_<wbr>MARKER</a></div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.__diff.html" title="fn test_utils::__diff">__diff</a></div></li><li><div class="item-name"><a class="fn" href="fn.add_cursor.html" title="fn test_utils::add_cursor">add_<wbr>cursor</a></div><div class="desc docblock-short">Inserts <code>$0</code> marker into the <code>text</code> at <code>offset</code>.</div></li><li><div class="item-name"><a class="fn" href="fn.bench.html" title="fn test_utils::bench">bench</a></div><div class="desc docblock-short">Utility for writing benchmark tests.</div></li><li><div class="item-name"><a class="fn" href="fn.ensure_file_contents.html" title="fn test_utils::ensure_file_contents">ensure_<wbr>file_<wbr>contents</a></div><div class="desc docblock-short">Checks that the <code>file</code> has the specified <code>contents</code>. If that is not the
|
|
case, updates the file and then fails the test.</div></li><li><div class="item-name"><a class="fn" href="fn.extract_annotations.html" title="fn test_utils::extract_annotations">extract_<wbr>annotations</a></div><div class="desc docblock-short">Extracts <code>//^^^ some text</code> annotations.</div></li><li><div class="item-name"><a class="fn" href="fn.extract_offset.html" title="fn test_utils::extract_offset">extract_<wbr>offset</a></div><div class="desc docblock-short">Infallible version of <code>try_extract_offset()</code>.</div></li><li><div class="item-name"><a class="fn" href="fn.extract_range.html" title="fn test_utils::extract_range">extract_<wbr>range</a></div><div class="desc docblock-short">Infallible version of <code>try_extract_range()</code>.</div></li><li><div class="item-name"><a class="fn" href="fn.extract_range_or_offset.html" title="fn test_utils::extract_range_or_offset">extract_<wbr>range_<wbr>or_<wbr>offset</a></div><div class="desc docblock-short">Extracts <code>TextRange</code> or <code>TextSize</code> depending on the amount of <code>$0</code> markers
|
|
found in <code>text</code>.</div></li><li><div class="item-name"><a class="fn" href="fn.extract_tags.html" title="fn test_utils::extract_tags">extract_<wbr>tags</a></div><div class="desc docblock-short">Extracts ranges, marked with <code><tag> </tag></code> pairs from the <code>text</code></div></li><li><div class="item-name"><a class="fn" href="fn.format_diff.html" title="fn test_utils::format_diff">format_<wbr>diff</a></div></li><li><div class="item-name"><a class="fn" href="fn.project_root.html" title="fn test_utils::project_root">project_<wbr>root</a></div><div class="desc docblock-short">Returns the path to the root directory of <code>rust-analyzer</code> project.</div></li><li><div class="item-name"><a class="fn" href="fn.skip_slow_tests.html" title="fn test_utils::skip_slow_tests">skip_<wbr>slow_<wbr>tests</a></div><div class="desc docblock-short">Returns <code>false</code> if slow tests should not run, otherwise returns <code>true</code> and
|
|
also creates a file at <code>./target/.slow_tests_cookie</code> which serves as a flag
|
|
that slow tests did run.</div></li><li><div class="item-name"><a class="fn" href="fn.try_ensure_file_contents.html" title="fn test_utils::try_ensure_file_contents">try_<wbr>ensure_<wbr>file_<wbr>contents</a></div><div class="desc docblock-short">Checks that the <code>file</code> has the specified <code>contents</code>. If that is not the
|
|
case, updates the file and return an Error.</div></li></ul><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="type" href="type.FxHashMap.html" title="type test_utils::FxHashMap">FxHash<wbr>Map</a></div><div class="desc docblock-short">Type alias for a hash map that uses the Fx hashing algorithm.</div></li></ul></section></div></main></body></html> |