Crate ra_ap_test_utils

Source
Expand description

Assorted testing utilities.

Most notable things are:

  • Rich text comparison, which outputs a diff.
  • Extracting markup (mainly, $0 markers) out of fixture strings.
  • marks (see the eponymous module).

Modules§

bench_fixture
Generates large snippets of Rust code for usage in the benchmarks.

Macros§

assert_eq_text
Asserts that two strings are equal, otherwise displays a rich diff between them.

Structs§

AssertLinear
Fixture
FixtureWithProjectMeta
MiniCore

Enums§

RangeOrOffset

Constants§

CURSOR_MARKER
ESCAPED_CURSOR_MARKER

Functions§

__diff
add_cursor
Inserts $0 marker into the text at offset.
bench
Utility for writing benchmark tests.
ensure_file_contents
Checks that the file has the specified contents. If that is not the case, updates the file and then fails the test.
extract_annotations
Extracts //^^^ some text annotations.
extract_offset
Infallible version of try_extract_offset().
extract_range
Infallible version of try_extract_range().
extract_range_or_offset
Extracts TextRange or TextSize depending on the amount of $0 markers found in text.
extract_tags
Extracts ranges, marked with <tag> </tag> pairs from the text
format_diff
project_root
Returns the path to the root directory of rust-analyzer project.
skip_slow_tests
Returns false if slow tests should not run, otherwise returns true and also creates a file at ./target/.slow_tests_cookie which serves as a flag that slow tests did run.
target_dir
try_ensure_file_contents
Checks that the file has the specified contents. If that is not the case, updates the file and return an Error.

Type Aliases§

FxHashMap
Type alias for a hash map that uses the Fx hashing algorithm.