@@ -80,6 +80,8 @@ impl QueryDirectoryResponse {
8080
8181#[ cfg( test) ]
8282mod tests {
83+ use time:: macros:: datetime;
84+
8385 use super :: * ;
8486 #[ test]
8587 pub fn test_both_directory_information_attribute_parse ( ) {
@@ -135,6 +137,100 @@ mod tests {
135137 . read_output ( )
136138 . unwrap ( ) ;
137139
138- // TODO: Test the contents of the result, not just that it parses.
140+ assert_eq ! (
141+ vec![
142+ ChainedItem :: new( FileIdBothDirectoryInformationInner {
143+ file_index: 0 ,
144+ creation_time: FileTime :: from( datetime!( 2024 -12 -11 12 : 32 : 31.7084985 ) ) ,
145+ last_access_time: FileTime :: from( datetime!( 2025 -01 -03 10 : 18 : 15.6499175 ) ) ,
146+ last_write_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 22 : 59.9648231 ) ) ,
147+ change_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 22 : 59.9648231 ) ) ,
148+ end_of_file: 0 ,
149+ allocation_size: 0 ,
150+ file_attributes: FileAttributes :: new( ) . with_directory( true ) ,
151+ ea_size: 0 ,
152+ short_name_length: 0 ,
153+ short_name: [ 0 ; 12 ] ,
154+ fild_id: 562949953454203 ,
155+ file_name: "." . into( ) ,
156+ } ) ,
157+ ChainedItem :: new( FileIdBothDirectoryInformationInner {
158+ file_index: 0 ,
159+ creation_time: FileTime :: from( datetime!( 2024 -12 -11 9 : 25 : 15.4208828 ) ) ,
160+ last_access_time: FileTime :: from( datetime!( 2025 -01 -02 19 : 05 : 31.8723088 ) ) ,
161+ last_write_time: FileTime :: from( datetime!( 2024 -12 -11 12 : 32 : 35.4544738 ) ) ,
162+ change_time: FileTime :: from( datetime!( 2024 -12 -11 12 : 32 : 35.4544738 ) ) ,
163+ end_of_file: 0 ,
164+ allocation_size: 0 ,
165+ file_attributes: FileAttributes :: new( ) . with_directory( true ) ,
166+ ea_size: 0 ,
167+ short_name_length: 0 ,
168+ short_name: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , ] ,
169+ fild_id: 1125899906967338 ,
170+ file_name: ".." . into( ) ,
171+ } ) ,
172+ ChainedItem :: new( FileIdBothDirectoryInformationInner {
173+ file_index: 0 ,
174+ creation_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 22 : 48.7929947 ) ) ,
175+ last_access_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 22 : 48.7929947 ) ) ,
176+ last_write_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 22 : 48.7929947 ) ) ,
177+ change_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 22 : 49.7460575 ) ) ,
178+ end_of_file: 0 ,
179+ allocation_size: 0 ,
180+ file_attributes: FileAttributes :: new( ) . with_archive( true ) ,
181+ ea_size: 0 ,
182+ short_name_length: 0 ,
183+ short_name: [ 0 ; 12 ] ,
184+ fild_id: 2814749767148784 ,
185+ file_name: "a.txt" . into( ) ,
186+ } ) ,
187+ ChainedItem :: new( FileIdBothDirectoryInformationInner {
188+ file_index: 0 ,
189+ creation_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 22 : 51.5742424 ) ) ,
190+ last_access_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 23 : 06.9505662 ) ) ,
191+ last_write_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 23 : 06.9505662 ) ) ,
192+ change_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 23 : 06.9505662 ) ) ,
193+ end_of_file: 6 ,
194+ allocation_size: 8 ,
195+ file_attributes: FileAttributes :: new( ) . with_archive( true ) ,
196+ ea_size: 0 ,
197+ short_name_length: 0 ,
198+ short_name: [ 0 ; 12 ] ,
199+ fild_id: 1125899906906297 ,
200+ file_name: "b.txt" . into( ) ,
201+ } ) ,
202+ ChainedItem :: new( FileIdBothDirectoryInformationInner {
203+ file_index: 0 ,
204+ creation_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 22 : 52.0116823 ) ) ,
205+ last_access_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 23 : 14.7795682 ) ) ,
206+ last_write_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 23 : 14.7795682 ) ) ,
207+ change_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 23 : 14.7795682 ) ) ,
208+ end_of_file: 486 ,
209+ allocation_size: 488 ,
210+ file_attributes: FileAttributes :: new( ) . with_archive( true ) ,
211+ ea_size: 0 ,
212+ short_name_length: 0 ,
213+ short_name: [ 0 ; 12 ] ,
214+ fild_id: 1125899906906299 ,
215+ file_name: "c.txt" . into( ) ,
216+ } , ) ,
217+ ChainedItem :: new( FileIdBothDirectoryInformationInner {
218+ file_index: 0 ,
219+ creation_time: FileTime :: from( datetime!( 2024 -12 -27 14 : 22 : 52.167941 ) , ) ,
220+ last_access_time: FileTime :: from( datetime!( 2025 -01 -02 19 : 05 : 44.7804931 ) , ) ,
221+ last_write_time: FileTime :: from( datetime!( 2025 -01 -02 19 : 05 : 44.7804931 ) , ) ,
222+ change_time: FileTime :: from( datetime!( 2025 -01 -02 19 : 05 : 44.7804931 ) , ) ,
223+ end_of_file: 15910 ,
224+ allocation_size: 16384 ,
225+ file_attributes: FileAttributes :: new( ) . with_archive( true ) ,
226+ ea_size: 0 ,
227+ short_name_length: 0 ,
228+ short_name: [ 0 ; 12 ] ,
229+ fild_id: 1125899906906300 ,
230+ file_name: "d.txt" . into( ) ,
231+ } )
232+ ] ,
233+ _res
234+ ) ;
139235 }
140236}
0 commit comments