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 } ;
2
2
3
3
#[ test]
4
4
fn test_abbreviate_short_string ( ) {
@@ -59,21 +59,21 @@ fn test_abbreviate_long_string_multiple_steps() {
59
59
}
60
60
61
61
#[ test]
62
- fn test_abbreviate_exclusions_are_detected ( ) {
62
+ fn test_abbreviate_filterss_are_detected ( ) {
63
63
let mut out = ProcOutput :: new ( ) ;
64
- let exclusions = & [ "foo" . to_string ( ) , "quux" . to_string ( ) ] ;
64
+ let filters = & [ "foo" . to_string ( ) , "quux" . to_string ( ) ] ;
65
65
66
- out. extend ( b"Hello foo" , exclusions ) ;
66
+ out. extend ( b"Hello foo" , filters ) ;
67
67
// 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 ) ;
69
69
// Check items are detected across extensions.
70
- out. extend ( b"ux." , exclusions ) ;
70
+ out. extend ( b"ux." , filters ) ;
71
71
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 >( )
77
77
) ,
78
78
ProcOutput :: Abbreviated { .. } => panic ! ( "out should not be abbreviated" ) ,
79
79
}
@@ -82,15 +82,15 @@ fn test_abbreviate_exclusions_are_detected() {
82
82
}
83
83
84
84
#[ test]
85
- fn test_abbreviate_exclusions_avoid_abbreviations ( ) {
85
+ fn test_abbreviate_filters_avoid_abbreviations ( ) {
86
86
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 > ( ) ] ;
88
88
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 ( ) ) ;
91
91
expected. extend_from_slice ( & vec ! [ b'.' ; TAIL_LEN ] ) ;
92
92
93
- out. extend ( & expected, exclusions ) ;
93
+ out. extend ( & expected, filters ) ;
94
94
95
95
// We first check the length to avoid endless terminal output if the length differs, since
96
96
// `out` is hundreds of KBs in size.
@@ -100,20 +100,20 @@ fn test_abbreviate_exclusions_avoid_abbreviations() {
100
100
}
101
101
102
102
#[ test]
103
- fn test_abbreviate_exclusions_can_still_cause_abbreviations ( ) {
103
+ fn test_abbreviate_filters_can_still_cause_abbreviations ( ) {
104
104
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 > ( ) ] ;
106
106
107
107
let mut input = vec ! [ b'.' ; HEAD_LEN ] ;
108
108
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 ( ) ) ;
110
110
111
111
let mut expected = vec ! [ b'.' ; HEAD_LEN ] ;
112
112
expected. extend_from_slice ( b"\n \n <<<<<< SKIPPED 64 BYTES >>>>>>\n \n " ) ;
113
113
expected. extend_from_slice ( & vec ! [ b'.' ; TAIL_LEN - 64 ] ) ;
114
114
expected. extend_from_slice ( & vec ! [ b'a' ; 64 ] ) ;
115
115
116
- out. extend ( & input, exclusions ) ;
116
+ out. extend ( & input, filters ) ;
117
117
118
118
// We first check the length to avoid endless terminal output if the length differs, since
119
119
// `out` is hundreds of KBs in size.
0 commit comments