diff options
author | Aleksey Kladov <[email protected]> | 2021-02-09 16:29:40 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-02-09 17:25:39 +0000 |
commit | 4b1279d0b160d98c1429ca1a52b37aa7a0af5775 (patch) | |
tree | 8b71d80a070120904b76fca78d8db45b3000e9b3 /crates/hir_ty | |
parent | 9ea2c96ddd0ad8c8898f1c65667a57a78ba2218c (diff) |
Infra for "unit" benchmarking
Diffstat (limited to 'crates/hir_ty')
-rw-r--r-- | crates/hir_ty/src/tests/macros.rs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/crates/hir_ty/src/tests/macros.rs b/crates/hir_ty/src/tests/macros.rs index c64f0b5b5..fb3afaedc 100644 --- a/crates/hir_ty/src/tests/macros.rs +++ b/crates/hir_ty/src/tests/macros.rs | |||
@@ -1,7 +1,5 @@ | |||
1 | use std::fs; | ||
2 | |||
3 | use expect_test::expect; | 1 | use expect_test::expect; |
4 | use test_utils::project_dir; | 2 | use test_utils::{bench, bench_fixture, skip_slow_tests}; |
5 | 3 | ||
6 | use super::{check_infer, check_types}; | 4 | use super::{check_infer, check_types}; |
7 | 5 | ||
@@ -617,12 +615,11 @@ hello | |||
617 | } | 615 | } |
618 | 616 | ||
619 | #[test] | 617 | #[test] |
620 | #[ignore] | 618 | fn benchmark_include_macro() { |
621 | fn include_accidentally_quadratic() { | 619 | if skip_slow_tests() { |
622 | let file = project_dir().join("crates/syntax/test_data/accidentally_quadratic"); | 620 | return; |
623 | let big_file = fs::read_to_string(file).unwrap(); | 621 | } |
624 | let big_file = vec![big_file; 10].join("\n"); | 622 | let data = bench_fixture::big_struct(); |
625 | |||
626 | let fixture = r#" | 623 | let fixture = r#" |
627 | //- /main.rs | 624 | //- /main.rs |
628 | #[rustc_builtin_macro] | 625 | #[rustc_builtin_macro] |
@@ -635,8 +632,12 @@ fn main() { | |||
635 | //^ RegisterBlock | 632 | //^ RegisterBlock |
636 | } | 633 | } |
637 | "#; | 634 | "#; |
638 | let fixture = format!("{}\n//- /foo.rs\n{}", fixture, big_file); | 635 | let fixture = format!("{}\n//- /foo.rs\n{}", fixture, data); |
639 | check_types(&fixture); | 636 | |
637 | { | ||
638 | let _b = bench("include macro"); | ||
639 | check_types(&fixture); | ||
640 | } | ||
640 | } | 641 | } |
641 | 642 | ||
642 | #[test] | 643 | #[test] |