-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: windows implement of
op::Write
is incorrect (#294)
* fix: fix windows position read/write bug Signed-off-by: Lzzzt <liuzitao0123@gmail.com> * ci: make clippy happy Signed-off-by: lzzzt <liuzitao0123@gmail.com> --------- Signed-off-by: Lzzzt <liuzitao0123@gmail.com> Signed-off-by: lzzzt <liuzitao0123@gmail.com>
- Loading branch information
Showing
7 changed files
with
99 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use tempfile::NamedTempFile; | ||
|
||
const HELLO: &[u8] = b"hello world..."; | ||
|
||
fn tempfile() -> NamedTempFile { | ||
NamedTempFile::new().expect("unable to create tempfile") | ||
} | ||
|
||
#[monoio::test_all] | ||
async fn read_file_all() { | ||
use std::io::Write; | ||
|
||
let mut tempfile = tempfile(); | ||
tempfile.write_all(HELLO).unwrap(); | ||
tempfile.as_file_mut().sync_data().unwrap(); | ||
|
||
let res = monoio::fs::read(tempfile.path()).await.unwrap(); | ||
assert_eq!(res, HELLO); | ||
} |