Skip to main content

Module test

Module test 

Source
Expand description

The expansion from a test function to the appropriate test struct for libtest Ideally, this code would be in libtest but for efficiency and error messages it lives here.

Re-exportsยง

use std::assert_matches; ๐Ÿ”’
use std::iter; ๐Ÿ”’
use rustc_ast as ast; ๐Ÿ”’
use rustc_ast::GeneratedAttr; ๐Ÿ”’
use rustc_ast::GenericParamKind; ๐Ÿ”’
use rustc_ast::Mutability; ๐Ÿ”’
use rustc_ast::attr; ๐Ÿ”’
use rustc_ast::join_path_idents; ๐Ÿ”’
use rustc_ast_pretty::pprust; ๐Ÿ”’
use rustc_attr_ir::Attribute; ๐Ÿ”’
use rustc_attr_ir::AttributeKind; ๐Ÿ”’
use rustc_attr_parsing::AttributeParser; ๐Ÿ”’
use rustc_errors::Applicability; ๐Ÿ”’
use rustc_errors::Diag; ๐Ÿ”’
use rustc_errors::Level; ๐Ÿ”’
use rustc_span::ErrorGuaranteed; ๐Ÿ”’
use rustc_span::Ident; ๐Ÿ”’
use rustc_span::RemapPathScopeComponents; ๐Ÿ”’
use rustc_span::Span; ๐Ÿ”’
use rustc_span::Symbol; ๐Ÿ”’
use rustc_span::sym; ๐Ÿ”’
use thin_vec::ThinVec; ๐Ÿ”’
use thin_vec::thin_vec; ๐Ÿ”’
use tracing::debug; ๐Ÿ”’
use crate::diagnostics; ๐Ÿ”’
use crate::util::check_builtin_macro_attribute; ๐Ÿ”’
use crate::util::warn_on_duplicate_attribute; ๐Ÿ”’
use rustc_expand::base::*; ๐Ÿ”’

Enumsยง

ShouldPanic ๐Ÿ”’
TestType ๐Ÿ”’

Functionsยง

check_bench_signature ๐Ÿ”’
check_test_signature ๐Ÿ”’
expand_bench ๐Ÿ”’
expand_test ๐Ÿ”’
expand_test_case ๐Ÿ”’
#test_case is used by custom test authors to mark tests When building for test, it needs to make the item public and gensym the name Otherwise, weโ€™ll omit the item. This behavior means that any item annotated with #test_case is never addressable.
expand_test_or_bench ๐Ÿ”’
get_location_info ๐Ÿ”’
item_path ๐Ÿ”’
not_testable_error ๐Ÿ”’
should_ignore ๐Ÿ”’
should_ignore_message ๐Ÿ”’
should_panic ๐Ÿ”’
test_type ๐Ÿ”’
Attempts to determine the type of test. Since doctests are created without macro expanding, only possible variants here are UnitTest, IntegrationTest or Unknown.