Skip to content

Commit

Permalink
fix: Fix "reader with too much data" test (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arshia001 authored Jan 4, 2023
1 parent 67448a3 commit e82b47b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions borsh/tests/test_custom_reader.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use borsh::{BorshDeserialize, BorshSerialize};

const ERROR_NOT_ALL_BYTES_READ: &str = "Not all bytes read";
const ERROR_UNEXPECTED_LENGTH_OF_INPUT: &str = "Unexpected length of input";

#[derive(BorshSerialize, BorshDeserialize, Debug)]
Expand Down Expand Up @@ -56,7 +57,7 @@ fn test_custom_reader_with_too_much_data() {
item3: 1.2345,
};
let mut bytes = s.try_to_vec().unwrap();
bytes.pop().unwrap();
bytes.push(1);
let mut reader = CustomReader {
data: bytes,
read_index: 0,
Expand All @@ -65,7 +66,7 @@ fn test_custom_reader_with_too_much_data() {
<Serializable as BorshDeserialize>::try_from_reader(&mut reader)
.unwrap_err()
.to_string(),
ERROR_UNEXPECTED_LENGTH_OF_INPUT
ERROR_NOT_ALL_BYTES_READ
);
}

Expand Down

0 comments on commit e82b47b

Please sign in to comment.