bump pyo3 and use anyhow for main functions
This commit is contained in:
parent
4e57289bab
commit
b8b4e28f2d
10 changed files with 401 additions and 115 deletions
|
|
@ -539,7 +539,7 @@ impl Serializable for EncodedValue {
|
|||
"Unexpected value argument 0x{arg:02x}: expected 0 for VALUE_ANNOTATION"
|
||||
)))
|
||||
} else {
|
||||
Ok(Self::Array(EncodedArray::deserialize(input)?))
|
||||
Ok(Self::Annotation(EncodedAnnotation::deserialize(input)?))
|
||||
}
|
||||
}
|
||||
VALUE_NULL => {
|
||||
|
|
@ -681,6 +681,7 @@ impl Serializable for Idx {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
fn boolean_deserialize() {
|
||||
|
|
@ -706,4 +707,35 @@ mod test {
|
|||
vec![0b0011_1111]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn annotation_deserialize() {
|
||||
assert_eq!(
|
||||
EncodedValue::deserialize_from_slice(&[0x1d, 0xf6, 0x33, 0x01, 0xd3, 0xe8, 0x02, 0x3f])
|
||||
.unwrap(),
|
||||
EncodedValue::Annotation(EncodedAnnotation {
|
||||
type_idx: Uleb128(6646),
|
||||
elements: vec![AnnotationElement {
|
||||
name_idx: Uleb128(46163),
|
||||
value: EncodedValue::Boolean(true)
|
||||
}]
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn annotation_serialize() {
|
||||
assert_eq!(
|
||||
vec![0x1d, 0xf6, 0x33, 0x01, 0xd3, 0xe8, 0x02, 0x3f],
|
||||
EncodedValue::Annotation(EncodedAnnotation {
|
||||
type_idx: Uleb128(6646),
|
||||
elements: vec![AnnotationElement {
|
||||
name_idx: Uleb128(46163),
|
||||
value: EncodedValue::Boolean(true)
|
||||
}]
|
||||
})
|
||||
.serialize_to_vec()
|
||||
.unwrap()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue