Skip to content

Commit 8ea9598

Browse files
committed
update tests
1 parent e257f38 commit 8ea9598

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/tools/compiletest/src/read2/tests.rs

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::read2::{ProcOutput, EXCLUDED_PLACEHOLDER_LEN, HEAD_LEN, TAIL_LEN};
1+
use crate::read2::{ProcOutput, FILTERED_PATHS_PLACEHOLDER_LEN, HEAD_LEN, TAIL_LEN};
22

33
#[test]
44
fn test_abbreviate_short_string() {
@@ -59,21 +59,21 @@ fn test_abbreviate_long_string_multiple_steps() {
5959
}
6060

6161
#[test]
62-
fn test_abbreviate_exclusions_are_detected() {
62+
fn test_abbreviate_filterss_are_detected() {
6363
let mut out = ProcOutput::new();
64-
let exclusions = &["foo".to_string(), "quux".to_string()];
64+
let filters = &["foo".to_string(), "quux".to_string()];
6565

66-
out.extend(b"Hello foo", exclusions);
66+
out.extend(b"Hello foo", filters);
6767
// Check items from a previous extension are not double-counted.
68-
out.extend(b"! This is a qu", exclusions);
68+
out.extend(b"! This is a qu", filters);
6969
// Check items are detected across extensions.
70-
out.extend(b"ux.", exclusions);
70+
out.extend(b"ux.", filters);
7171

72-
match out {
73-
ProcOutput::Full { excluded_len, .. } => assert_eq!(
74-
excluded_len,
75-
EXCLUDED_PLACEHOLDER_LEN * exclusions.len() as isize
76-
- exclusions.iter().map(|i| i.len() as isize).sum::<isize>()
72+
match &out {
73+
ProcOutput::Full { bytes, filtered_len } => assert_eq!(
74+
*filtered_len,
75+
bytes.len() + FILTERED_PATHS_PLACEHOLDER_LEN * filters.len()
76+
- filters.iter().map(|i| i.len()).sum::<usize>()
7777
),
7878
ProcOutput::Abbreviated { .. } => panic!("out should not be abbreviated"),
7979
}
@@ -82,15 +82,15 @@ fn test_abbreviate_exclusions_are_detected() {
8282
}
8383

8484
#[test]
85-
fn test_abbreviate_exclusions_avoid_abbreviations() {
85+
fn test_abbreviate_filters_avoid_abbreviations() {
8686
let mut out = ProcOutput::new();
87-
let exclusions = &[std::iter::repeat('a').take(64).collect::<String>()];
87+
let filters = &[std::iter::repeat('a').take(64).collect::<String>()];
8888

89-
let mut expected = vec![b'.'; HEAD_LEN - EXCLUDED_PLACEHOLDER_LEN as usize];
90-
expected.extend_from_slice(exclusions[0].as_bytes());
89+
let mut expected = vec![b'.'; HEAD_LEN - FILTERED_PATHS_PLACEHOLDER_LEN as usize];
90+
expected.extend_from_slice(filters[0].as_bytes());
9191
expected.extend_from_slice(&vec![b'.'; TAIL_LEN]);
9292

93-
out.extend(&expected, exclusions);
93+
out.extend(&expected, filters);
9494

9595
// We first check the length to avoid endless terminal output if the length differs, since
9696
// `out` is hundreds of KBs in size.
@@ -100,20 +100,20 @@ fn test_abbreviate_exclusions_avoid_abbreviations() {
100100
}
101101

102102
#[test]
103-
fn test_abbreviate_exclusions_can_still_cause_abbreviations() {
103+
fn test_abbreviate_filters_can_still_cause_abbreviations() {
104104
let mut out = ProcOutput::new();
105-
let exclusions = &[std::iter::repeat('a').take(64).collect::<String>()];
105+
let filters = &[std::iter::repeat('a').take(64).collect::<String>()];
106106

107107
let mut input = vec![b'.'; HEAD_LEN];
108108
input.extend_from_slice(&vec![b'.'; TAIL_LEN]);
109-
input.extend_from_slice(exclusions[0].as_bytes());
109+
input.extend_from_slice(filters[0].as_bytes());
110110

111111
let mut expected = vec![b'.'; HEAD_LEN];
112112
expected.extend_from_slice(b"\n\n<<<<<< SKIPPED 64 BYTES >>>>>>\n\n");
113113
expected.extend_from_slice(&vec![b'.'; TAIL_LEN - 64]);
114114
expected.extend_from_slice(&vec![b'a'; 64]);
115115

116-
out.extend(&input, exclusions);
116+
out.extend(&input, filters);
117117

118118
// We first check the length to avoid endless terminal output if the length differs, since
119119
// `out` is hundreds of KBs in size.

0 commit comments

Comments
 (0)