Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 433c175

Browse files
committed
Move unit tests to use generated dirs under target/
1 parent e2bc57b commit 433c175

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

src/test/lens.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{
1717
fn test_lens_run() {
1818
use serde_json::json;
1919

20-
let mut env = Environment::new("lens_run");
20+
let mut env = Environment::generate_from_fixture("lens_run");
2121

2222
let source_file_path = Path::new("src").join("main.rs");
2323

src/test/mod.rs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn notification<A: ls_server::BlockingNotificationAction>(params: A::Params) ->
9696

9797
#[test]
9898
fn test_shutdown() {
99-
let mut env = Environment::new("common");
99+
let mut env = Environment::generate_from_fixture("common");
100100

101101
let root_path = env.cache.abs_path(Path::new("."));
102102

@@ -129,7 +129,7 @@ fn test_shutdown() {
129129

130130
#[test]
131131
fn test_goto_def() {
132-
let mut env = Environment::new("common");
132+
let mut env = Environment::generate_from_fixture("common");
133133

134134
let source_file_path = Path::new("src").join("main.rs");
135135

@@ -179,7 +179,7 @@ fn test_goto_def() {
179179

180180
#[test]
181181
fn test_hover() {
182-
let mut env = Environment::new("common");
182+
let mut env = Environment::generate_from_fixture("common");
183183

184184
let source_file_path = Path::new("src").join("main.rs");
185185

@@ -229,7 +229,7 @@ fn test_hover() {
229229
/// Test hover continues to work after the source has moved line
230230
#[test]
231231
fn test_hover_after_src_line_change() {
232-
let mut env = Environment::new("common");
232+
let mut env = Environment::generate_from_fixture("common");
233233

234234
let source_file_path = Path::new("src").join("main.rs");
235235

@@ -330,7 +330,7 @@ fn test_hover_after_src_line_change() {
330330

331331
#[test]
332332
fn test_workspace_symbol() {
333-
let mut env = Environment::new("workspace_symbol");
333+
let mut env = Environment::generate_from_fixture("workspace_symbol");
334334

335335
let root_path = env.cache.abs_path(Path::new("."));
336336

@@ -386,7 +386,7 @@ fn test_workspace_symbol() {
386386

387387
#[test]
388388
fn test_workspace_symbol_duplicates() {
389-
let mut env = Environment::new("workspace_symbol_duplicates");
389+
let mut env = Environment::generate_from_fixture("workspace_symbol_duplicates");
390390

391391
let root_path = env.cache.abs_path(Path::new("."));
392392

@@ -444,7 +444,7 @@ fn test_workspace_symbol_duplicates() {
444444

445445
#[test]
446446
fn test_find_all_refs() {
447-
let mut env = Environment::new("common");
447+
let mut env = Environment::generate_from_fixture("common");
448448

449449
let source_file_path = Path::new("src").join("main.rs");
450450

@@ -501,7 +501,7 @@ fn test_find_all_refs() {
501501

502502
#[test]
503503
fn test_find_all_refs_no_cfg_test() {
504-
let mut env = Environment::new("find_all_refs_no_cfg_test");
504+
let mut env = Environment::generate_from_fixture("find_all_refs_no_cfg_test");
505505
env.with_config(|c| c.all_targets = false);
506506

507507
let source_file_path = Path::new("src").join("main.rs");
@@ -556,7 +556,7 @@ fn test_find_all_refs_no_cfg_test() {
556556

557557
#[test]
558558
fn test_borrow_error() {
559-
let mut env = Environment::new("borrow_error");
559+
let mut env = Environment::generate_from_fixture("borrow_error");
560560

561561
let root_path = env.cache.abs_path(Path::new("."));
562562
let messages =
@@ -588,7 +588,7 @@ fn test_borrow_error() {
588588

589589
#[test]
590590
fn test_highlight() {
591-
let mut env = Environment::new("common");
591+
let mut env = Environment::generate_from_fixture("common");
592592

593593
let source_file_path = Path::new("src").join("main.rs");
594594

@@ -641,7 +641,7 @@ fn test_highlight() {
641641

642642
#[test]
643643
fn test_rename() {
644-
let mut env = Environment::new("common");
644+
let mut env = Environment::generate_from_fixture("common");
645645

646646
let source_file_path = Path::new("src").join("main.rs");
647647

@@ -696,7 +696,7 @@ fn test_rename() {
696696

697697
#[test]
698698
fn test_reformat() {
699-
let mut env = Environment::new("reformat");
699+
let mut env = Environment::generate_from_fixture("reformat");
700700

701701
let source_file_path = Path::new("src").join("main.rs");
702702

@@ -748,7 +748,7 @@ fn test_reformat() {
748748

749749
#[test]
750750
fn test_reformat_with_range() {
751-
let mut env = Environment::new("reformat_with_range");
751+
let mut env = Environment::generate_from_fixture("reformat_with_range");
752752
let source_file_path = Path::new("src").join("main.rs");
753753

754754
let root_path = env.cache.abs_path(Path::new("."));
@@ -809,7 +809,7 @@ fn test_reformat_with_range() {
809809

810810
#[test]
811811
fn test_multiple_binaries() {
812-
let mut env = Environment::new("multiple_bins");
812+
let mut env = Environment::generate_from_fixture("multiple_bins");
813813

814814
let root_path = env.cache.abs_path(Path::new("."));
815815
let messages =
@@ -849,7 +849,7 @@ fn test_multiple_binaries() {
849849
// FIXME Requires rust-src component, which would break Rust CI
850850
// #[test]
851851
// fn test_completion() {
852-
// let mut env = Environment::new("common");
852+
// let mut env = Environment::generate_from_fixture("common");
853853

854854
// let source_file_path = Path::new("src").join("main.rs");
855855

@@ -888,7 +888,7 @@ fn test_multiple_binaries() {
888888

889889
#[test]
890890
fn test_bin_lib_project() {
891-
let mut env = Environment::new("bin_lib");
891+
let mut env = Environment::generate_from_fixture("bin_lib");
892892

893893
let root_path = env.cache.abs_path(Path::new("."));
894894

@@ -933,7 +933,7 @@ fn test_bin_lib_project() {
933933
// FIXME(#524) timing issues when run concurrently with `test_bin_lib_project`
934934
// #[test]
935935
// fn test_bin_lib_project_no_cfg_test() {
936-
// let mut env = Environment::new("bin_lib");
936+
// let mut env = Environment::generate_from_fixture("bin_lib");
937937

938938
// let root_path = env.cache.abs_path(Path::new("."));
939939

@@ -958,7 +958,7 @@ fn test_bin_lib_project() {
958958
// FIXME(#455) reinstate this test
959959
// #[test]
960960
// fn test_simple_workspace() {
961-
// let mut env = Environment::new("simple_workspace");
961+
// let mut env = Environment::generate_from_fixture("simple_workspace");
962962

963963
// let root_path = env.cache.abs_path(Path::new("."));
964964

@@ -982,7 +982,7 @@ fn test_bin_lib_project() {
982982

983983
#[test]
984984
fn test_infer_lib() {
985-
let mut env = Environment::new("infer_lib");
985+
let mut env = Environment::generate_from_fixture("infer_lib");
986986

987987
let root_path = env.cache.abs_path(Path::new("."));
988988
let messages =
@@ -1018,7 +1018,7 @@ fn test_infer_lib() {
10181018

10191019
#[test]
10201020
fn test_infer_bin() {
1021-
let mut env = Environment::new("infer_bin");
1021+
let mut env = Environment::generate_from_fixture("infer_bin");
10221022

10231023
let root_path = env.cache.abs_path(Path::new("."));
10241024
let messages =
@@ -1054,7 +1054,7 @@ fn test_infer_bin() {
10541054

10551055
#[test]
10561056
fn test_infer_custom_bin() {
1057-
let mut env = Environment::new("infer_custom_bin");
1057+
let mut env = Environment::generate_from_fixture("infer_custom_bin");
10581058

10591059
let root_path = env.cache.abs_path(Path::new("."));
10601060
let messages =
@@ -1093,7 +1093,7 @@ fn test_infer_custom_bin() {
10931093
fn test_omit_init_build() {
10941094
use serde_json::json;
10951095

1096-
let mut env = Environment::new("common");
1096+
let mut env = Environment::generate_from_fixture("common");
10971097

10981098
let root_path = env.cache.abs_path(Path::new("."));
10991099
let root_path = root_path.as_os_str().to_str().map(|x| x.to_owned());
@@ -1120,7 +1120,7 @@ fn test_omit_init_build() {
11201120
fn test_init_with_configuration() {
11211121
use serde_json::json;
11221122

1123-
let mut env = Environment::new("common");
1123+
let mut env = Environment::generate_from_fixture("common");
11241124

11251125
let root_path = env.cache.abs_path(Path::new("."));
11261126
let root_path = root_path.as_os_str().to_str().map(|x| x.to_owned());
@@ -1196,7 +1196,7 @@ fn test_parse_error_on_malformed_input() {
11961196

11971197
#[test]
11981198
fn test_find_impls() {
1199-
let mut env = Environment::new("find_impls");
1199+
let mut env = Environment::generate_from_fixture("find_impls");
12001200

12011201
let source_file_path = Path::new("src").join("main.rs");
12021202

@@ -1292,7 +1292,7 @@ fn test_find_impls() {
12921292

12931293
#[test]
12941294
fn test_features() {
1295-
let mut env = Environment::new("features");
1295+
let mut env = Environment::generate_from_fixture("features");
12961296

12971297
let root_path = env.cache.abs_path(Path::new("."));
12981298
let messages =
@@ -1331,7 +1331,7 @@ fn test_features() {
13311331

13321332
#[test]
13331333
fn test_all_features() {
1334-
let mut env = Environment::new("features");
1334+
let mut env = Environment::generate_from_fixture("features");
13351335

13361336
let root_path = env.cache.abs_path(Path::new("."));
13371337
let messages =
@@ -1355,7 +1355,7 @@ fn test_all_features() {
13551355

13561356
#[test]
13571357
fn test_no_default_features() {
1358-
let mut env = Environment::new("features");
1358+
let mut env = Environment::generate_from_fixture("features");
13591359

13601360
let root_path = env.cache.abs_path(Path::new("."));
13611361
let messages =
@@ -1397,7 +1397,7 @@ fn test_no_default_features() {
13971397

13981398
// #[test]
13991399
// fn test_handle_utf8_directory() {
1400-
// let mut env = Environment::new("unicødë");
1400+
// let mut env = Environment::generate_from_fixture("unicødë");
14011401
//
14021402
// let root_path = env.cache.abs_path(Path::new("."));
14031403
// let root_url = Url::from_directory_path(&root_path).unwrap();
@@ -1419,7 +1419,7 @@ fn test_no_default_features() {
14191419

14201420
#[test]
14211421
fn test_deglob() {
1422-
let mut env = Environment::new("deglob");
1422+
let mut env = Environment::generate_from_fixture("deglob");
14231423

14241424
let source_file_path = Path::new("src").join("main.rs");
14251425

@@ -1638,7 +1638,7 @@ fn test_deglob() {
16381638

16391639
#[test]
16401640
fn test_all_targets() {
1641-
let mut env = Environment::new("bin_lib");
1641+
let mut env = Environment::generate_from_fixture("bin_lib");
16421642

16431643
let root_path = env.cache.abs_path(Path::new("."));
16441644

@@ -1683,7 +1683,7 @@ fn test_all_targets() {
16831683
/// continuing to run
16841684
#[test]
16851685
fn ignore_uninitialized_notification() {
1686-
let mut env = Environment::new("common");
1686+
let mut env = Environment::generate_from_fixture("common");
16871687

16881688
let source_file_path = Path::new("src").join("main.rs");
16891689

@@ -1741,7 +1741,7 @@ fn ignore_uninitialized_notification() {
17411741
/// and continuing to run
17421742
#[test]
17431743
fn fail_uninitialized_request() {
1744-
let mut env = Environment::new("common");
1744+
let mut env = Environment::generate_from_fixture("common");
17451745

17461746
let source_file_path = Path::new("src").join("main.rs");
17471747
let root_path = env.cache.abs_path(Path::new("."));
@@ -1798,7 +1798,7 @@ fn fail_uninitialized_request() {
17981798
// FIXME disabled since it is failing in the Rust repo.
17991799
// #[test]
18001800
// fn test_dep_fail() {
1801-
// let mut env = Environment::new("dep_fail");
1801+
// let mut env = Environment::generate_from_fixture("dep_fail");
18021802

18031803
// let root_path = env.cache.abs_path(Path::new("."));
18041804

0 commit comments

Comments
 (0)