[][src]Crate ra_ap_test_utils

Assorted testing utilities.

Most notable things are:

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

Modules

mark

This module implements manually tracked test coverage, which is useful for quickly finding a test responsible for testing a particular bit of code.

Macros

_check
_hit
assert_eq_text

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

Structs

Fixture
__Changeset

The information about a full changeset

Enums

RangeOrOffset

Constants

CURSOR_MARKER

Functions

add_cursor

Inserts <|> marker into the text at offset.

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 <|> markers found in text.

extract_tags

Extracts ranges, marked with <tag> </tag> pairs from the text

find_mismatch

Compares JSON object for approximate equality. You can use [..] wildcard in strings (useful for OS dependent things such as paths). You can use a "{...}" string literal as a wildcard for arbitrary nested JSON. Arrays are sorted before comparison.

lines_match

Compare a line with an expected pattern.

project_dir

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.

Type Definitions

FxHashMap

Type alias for a hashmap using the fx hash algorithm.