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

Commit b4ff380

Browse files
committed
Split std tooltip tests out to allow others to run always
Remove --cfg=enabled_tooltip_tests jazz
1 parent 2edbc7b commit b4ff380

File tree

2 files changed

+39
-3
lines changed

2 files changed

+39
-3
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ install: |
2020
script:
2121
- cargo build -v
2222
- cargo test -v
23+
- cargo test test_tooltip_std -- --ignored
24+
2325
env:
2426
global:
25-
- RUSTFLAGS=--cfg=enable_tooltip_tests
2627
- RUST_BACKTRACE=1
2728
- RLS_TEST_WAIT_FOR_AGES=1
2829
- CARGO_INCREMENTAL=0

src/actions/hover.rs

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,8 +2030,6 @@ pub mod test {
20302030
}
20312031

20322032
#[test]
2033-
// doesn't work in the rust-lang/rust repo, enable on CI
2034-
#[cfg_attr(not(enable_tooltip_tests), ignore)]
20352033
fn test_tooltip() -> Result<(), Box<dyn std::error::Error>> {
20362034
use self::test::{LineOutput, Test, TooltipTestHarness};
20372035
use std::env;
@@ -2090,6 +2088,43 @@ pub mod test {
20902088
Test::new("test_tooltip_mod_use_external.rs", 12, 12),
20912089
Test::new("test_tooltip_mod_use_external.rs", 14, 12),
20922090
Test::new("test_tooltip_mod_use_external.rs", 15, 12),
2091+
];
2092+
2093+
let cwd = env::current_dir()?;
2094+
let out = LineOutput::default();
2095+
let proj_dir = cwd.join("test_data").join("hover");
2096+
let save_dir = cwd
2097+
.join("target")
2098+
.join("tests")
2099+
.join("hover")
2100+
.join("save_data");
2101+
let load_dir = proj_dir.join("save_data");
2102+
2103+
let harness = TooltipTestHarness::new(proj_dir, &out);
2104+
2105+
out.reset();
2106+
2107+
let failures = harness.run_tests(&tests, load_dir, save_dir)?;
2108+
2109+
if failures.is_empty() {
2110+
Ok(())
2111+
} else {
2112+
eprintln!("{}\n\n", out.reset().join("\n"));
2113+
eprintln!("{:#?}\n\n", failures);
2114+
Err(format!("{} of {} tooltip tests failed", failures.len(), tests.len()).into())
2115+
}
2116+
}
2117+
2118+
/// Note: This test is ignored as it doesn't work in the rust-lang/rust repo.
2119+
/// It is enabled on CI.
2120+
/// Run with `cargo test test_tooltip_std -- --ignored`
2121+
#[test]
2122+
#[ignore]
2123+
fn test_tooltip_std() -> Result<(), Box<dyn std::error::Error>> {
2124+
use self::test::{LineOutput, Test, TooltipTestHarness};
2125+
use std::env;
2126+
2127+
let tests = vec![
20932128
Test::new("test_tooltip_std.rs", 18, 15),
20942129
Test::new("test_tooltip_std.rs", 18, 27),
20952130
Test::new("test_tooltip_std.rs", 19, 7),

0 commit comments

Comments
 (0)