Migrate tests .txt -> .rast
The sytax tree output files now use .rast extension (rust-analyzer syntax tree or rust abstract syntax tree (whatever)). This format has a editors/code/ra_syntax_tree.tmGrammar.json declaration that supplies nice syntax highlighting for .rast files.
This commit is contained in:
parent
ec3fb1cdb4
commit
da091b1303
crates/ra_syntax
src
test_data/parser
err
0000_struct_field_missing_comma.rast0001_item_recovery_in_file.rast0002_duplicate_shebang.rast0003_C++_semicolon.rast0004_use_path_bad_segment.rast0005_attribute_recover.rast0006_named_field_recovery.rast0007_stray_curly_in_file.rast0008_item_block_recovery.rast0009_broken_struct_type_parameter.rast0010_unsafe_lambda_block.rast0011_extern_struct.rast0012_broken_lambda.rast0013_invalid_type.rast0014_where_no_bounds.rast0015_curly_in_params.rast0016_missing_semi.rast0017_incomplete_binexpr.rast0018_incomplete_fn.rast0019_let_recover.rast0020_fn_recover.rast0021_incomplete_param.rast0022_bad_exprs.rast0023_mismatched_paren.rast0024_many_type_parens.rast0025_nope.rast0026_imp_recovery.rast0027_incomplere_where_for.rast0029_field_completion.rast0031_block_inner_attrs.rast0032_match_arms_inner_attrs.rast0033_match_arms_outer_attrs.rast0034_bad_box_pattern.rast0035_use_recover.rast0036_partial_use.rast0037_visibility_in_traits.rast0038_endless_inclusive_range.rast0039_lambda_recovery.rast
inline
err
0001_array_type_missing_semi.rast0002_misplaced_label_err.rast0003_pointer_type_no_mutability.rast0004_impl_type.rast0005_fn_pointer_type_missing_fn.rast0006_unsafe_block_in_mod.rast0007_async_without_semicolon.rast0008_pub_expr.rast0009_attr_on_expr_not_allowed.rast0010_bad_tuple_index_expr.rast0010_wrong_order_fns.rast0013_static_underscore.rast0014_default_fn_type.rast
ok
0001_trait_item_list.rast0002_use_tree_list.rast0003_where_pred_for.rast0004_value_parameters_no_patterns.rast0005_function_type_params.rast0006_self_param.rast0007_type_param_bounds.rast0008_path_part.rast0009_loop_expr.rast0010_extern_block.rast0011_field_expr.rast0012_type_item_where_clause.rast0013_pointer_type_mut.rast0014_never_type.rast0015_continue_expr.rast0016_unsafe_trait.rast0017_array_type.rast0018_arb_self_types.rast0019_unary_expr.rast0020_use_star.rast0021_impl_item_list.rast0022_crate_visibility.rast0023_placeholder_type.rast0024_slice_pat.rast0025_slice_type.rast0026_tuple_pat_fields.rast0027_ref_pat.rast0028_impl_trait_type.rast0029_cast_expr.rast0030_cond.rast0031_while_expr.rast0032_fn_pointer_type.rast0033_reference_type;.rast0034_break_expr.rast0036_unsafe_extern_fn.rast0037_qual_paths.rast0038_full_range_expr.rast0039_type_arg.rast0040_crate_keyword_vis.rast0041_trait_item.rast0042_call_expr.rast0043_use_alias.rast0044_block_items.rast0045_param_list_opt_patterns.rast0046_singleton_tuple_type.rast0047_unsafe_default_impl.rast0048_path_type_with_bounds.rast0050_fn_decl.rast
@ -3,7 +3,7 @@ use std::{
|
||||
path::{Component, Path, PathBuf},
|
||||
};
|
||||
|
||||
use test_utils::{collect_tests, dir_tests, project_dir, read_text};
|
||||
use test_utils::{collect_rust_files, dir_tests, project_dir, read_text};
|
||||
|
||||
use crate::{fuzz, tokenize, SourceFile, SyntaxError, TextRange, TextUnit, Token};
|
||||
|
||||
@ -13,12 +13,12 @@ fn lexer_tests() {
|
||||
// * Add tests for unicode escapes in byte-character and [raw]-byte-string literals
|
||||
// * Add tests for unescape errors
|
||||
|
||||
dir_tests(&test_data_dir(), &["lexer/ok"], |text, path| {
|
||||
dir_tests(&test_data_dir(), &["lexer/ok"], "txt", |text, path| {
|
||||
let (tokens, errors) = tokenize(text);
|
||||
assert_errors_are_absent(&errors, path);
|
||||
dump_tokens_and_errors(&tokens, &errors, text)
|
||||
});
|
||||
dir_tests(&test_data_dir(), &["lexer/err"], |text, path| {
|
||||
dir_tests(&test_data_dir(), &["lexer/err"], "txt", |text, path| {
|
||||
let (tokens, errors) = tokenize(text);
|
||||
assert_errors_are_present(&errors, path);
|
||||
dump_tokens_and_errors(&tokens, &errors, text)
|
||||
@ -40,13 +40,13 @@ fn main() {
|
||||
|
||||
#[test]
|
||||
fn parser_tests() {
|
||||
dir_tests(&test_data_dir(), &["parser/inline/ok", "parser/ok"], |text, path| {
|
||||
dir_tests(&test_data_dir(), &["parser/inline/ok", "parser/ok"], "rast", |text, path| {
|
||||
let parse = SourceFile::parse(text);
|
||||
let errors = parse.errors();
|
||||
assert_errors_are_absent(&errors, path);
|
||||
parse.debug_dump()
|
||||
});
|
||||
dir_tests(&test_data_dir(), &["parser/err", "parser/inline/err"], |text, path| {
|
||||
dir_tests(&test_data_dir(), &["parser/err", "parser/inline/err"], "rast", |text, path| {
|
||||
let parse = SourceFile::parse(text);
|
||||
let errors = parse.errors();
|
||||
assert_errors_are_present(&errors, path);
|
||||
@ -56,14 +56,14 @@ fn parser_tests() {
|
||||
|
||||
#[test]
|
||||
fn parser_fuzz_tests() {
|
||||
for (_, text) in collect_tests(&test_data_dir(), &["parser/fuzz-failures"]) {
|
||||
for (_, text) in collect_rust_files(&test_data_dir(), &["parser/fuzz-failures"]) {
|
||||
fuzz::check_parser(&text)
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reparse_fuzz_tests() {
|
||||
for (_, text) in collect_tests(&test_data_dir(), &["reparse/fuzz-failures"]) {
|
||||
for (_, text) in collect_rust_files(&test_data_dir(), &["reparse/fuzz-failures"]) {
|
||||
let check = fuzz::CheckReparse::from_data(text.as_bytes()).unwrap();
|
||||
println!("{:?}", check);
|
||||
check.run();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user