@@ -178,31 +178,40 @@ impl Chunker for CharactersChunker {
178178
179179#[ cfg( test) ]
180180mod tests {
181- use super :: * ;
182- use crate :: stream:: FileUtf8BlockReader ;
183181
184- const FILE_PATH : & str = "../../test-data/realistic-1.0mb.txt" ;
182+ use super :: * ;
183+ // use std::path::PathBuf;
184+ // use crate::stream::FileUtf8BlockReader;
185+
186+ // fn get_test_file_path() -> String {
187+ // let manifest_dir = env!("CARGO_MANIFEST_DIR");
188+ // PathBuf::from(manifest_dir)
189+ // .join("../test-data/realistic-1.0mb.txt")
190+ // .to_string_lossy()
191+ // .into_owned()
192+ // }
193+
194+ // #[test]
195+ // fn test_string_buffer_compaction() {
196+ // let reader = FileUtf8BlockReader::new(get_test_file_path().as_str(), 1024 * 8).unwrap();
197+
198+ // let mut string_buffer = StringBuffer::new(reader, 1024 * 16);
199+
200+ // while !string_buffer.done {
201+ // let content = string_buffer.buffer();
202+ // let content_len = content.len();
203+ // let can = content.is_char_boundary(content_len - 10);
204+ // if can {
205+ // string_buffer.set_position(content_len - 10);
206+ // assert!(
207+ // string_buffer.position == 0,
208+ // "Position should be updated correctly"
209+ // );
210+ // assert!(string_buffer.len() <= 10);
211+ // }
212+ // }
213+ // }
185214
186- #[ test]
187- fn test_string_buffer_compaction ( ) {
188- let reader = FileUtf8BlockReader :: new ( FILE_PATH , 1024 * 8 ) . unwrap ( ) ;
189-
190- let mut string_buffer = StringBuffer :: new ( reader, 1024 * 16 ) ;
191-
192- while !string_buffer. done {
193- let content = string_buffer. buffer ( ) ;
194- let content_len = content. len ( ) ;
195- let can = content. is_char_boundary ( content_len - 10 ) ;
196- if can {
197- string_buffer. set_position ( content_len - 10 ) ;
198- assert ! (
199- string_buffer. position == 0 ,
200- "Position should be updated correctly"
201- ) ;
202- assert ! ( string_buffer. len( ) <= 10 ) ;
203- }
204- }
205- }
206215 #[ test]
207216 fn test_characters_chunker_stream ( ) {
208217 // let reader = FileUtf8BlockReader::new(FILE_PATH, 1024 * 8).unwrap();
0 commit comments