Skip to content

Commit 2471539

Browse files
committed
Fix tests using Error instead of ErrorKind
1 parent 7f3e11a commit 2471539

File tree

6 files changed

+25
-26
lines changed

6 files changed

+25
-26
lines changed

src/io/per/unaligned/buffer.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ pub mod tests {
409409
assert!(buffer.read_bit()?);
410410
assert!(!buffer.read_bit()?);
411411

412-
assert_eq!(buffer.read_bit(), Err(Error::EndOfStream));
412+
assert_eq!(buffer.read_bit(), Err(ErrorKind::EndOfStream.into()));
413413

414414
Ok(())
415415
}
@@ -789,12 +789,12 @@ pub mod tests {
789789
// lower check
790790
assert_eq!(
791791
buffer.write_constrained_whole_number(10, 127, 0),
792-
Err(Error::ValueNotInRange(0, 10, 127))
792+
Err(ErrorKind::ValueNotInRange(0, 10, 127).into())
793793
);
794794
// upper check
795795
assert_eq!(
796796
buffer.write_constrained_whole_number(10, 127, 128),
797-
Err(Error::ValueNotInRange(128, 10, 127))
797+
Err(ErrorKind::ValueNotInRange(128, 10, 127).into())
798798
);
799799
}
800800

@@ -804,12 +804,12 @@ pub mod tests {
804804
// lower check
805805
assert_eq!(
806806
buffer.write_constrained_whole_number(-10, -1, -11),
807-
Err(Error::ValueNotInRange(-11, -10, -1))
807+
Err(ErrorKind::ValueNotInRange(-11, -10, -1).into())
808808
);
809809
// upper check
810810
assert_eq!(
811811
buffer.write_constrained_whole_number(-10, -1, 0),
812-
Err(Error::ValueNotInRange(0, -10, -1))
812+
Err(ErrorKind::ValueNotInRange(0, -10, -1).into())
813813
);
814814
}
815815

@@ -819,12 +819,12 @@ pub mod tests {
819819
// lower check
820820
assert_eq!(
821821
buffer.write_constrained_whole_number(-10, 1, -11),
822-
Err(Error::ValueNotInRange(-11, -10, 1))
822+
Err(ErrorKind::ValueNotInRange(-11, -10, 1).into())
823823
);
824824
// upper check
825825
assert_eq!(
826826
buffer.write_constrained_whole_number(-10, 1, 2),
827-
Err(Error::ValueNotInRange(2, -10, 1))
827+
Err(ErrorKind::ValueNotInRange(2, -10, 1).into())
828828
);
829829
}
830830

tests/basic_ia5string.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ fn detect_only_invalid_character() {
3636
}
3737
.write(&mut writer);
3838
assert_eq!(
39-
Err(asn1rs::io::per::Error::InvalidString(
40-
asn1rs::model::Charset::Ia5,
41-
'\u{80}',
42-
128
43-
)),
39+
Err(
40+
asn1rs::io::per::ErrorKind::InvalidString(asn1rs::model::Charset::Ia5, '\u{80}', 128)
41+
.into()
42+
),
4443
result
4544
)
4645
}

tests/basic_numeric_string.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@ fn detect_only_invalid_character() {
3535
}
3636
.write(&mut writer);
3737
assert_eq!(
38-
Err(asn1rs::io::per::Error::InvalidString(
39-
asn1rs::model::Charset::Numeric,
40-
'x',
41-
11
42-
)),
38+
Err(
39+
asn1rs::io::per::ErrorKind::InvalidString(asn1rs::model::Charset::Numeric, 'x', 11)
40+
.into()
41+
),
4342
result
4443
)
4544
}

tests/basic_printable_string.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ fn detect_only_invalid_character() {
3636
}
3737
.write(&mut writer);
3838
assert_eq!(
39-
Err(asn1rs::io::per::Error::InvalidString(
40-
asn1rs::model::Charset::Printable,
41-
'!',
42-
74
43-
)),
39+
Err(
40+
asn1rs::io::per::ErrorKind::InvalidString(asn1rs::model::Charset::Printable, '!', 74)
41+
.into()
42+
),
4443
result
4544
)
4645
}

tests/basic_proc_macro_attribute.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,9 +698,10 @@ fn test_extensible_struct_fail_inconsistent() {
698698
value16: Some(146),
699699
};
700700
assert_eq!(
701-
Err(asn1rs::io::per::Error::ExtensionFieldsInconsistent(
701+
Err(asn1rs::io::per::ErrorKind::ExtensionFieldsInconsistent(
702702
"ExtensibleStruct".to_string()
703-
)),
703+
)
704+
.into()),
704705
uper.write(&v)
705706
);
706707
}

tests/basic_visible_string.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ fn detect_only_invalid_character() {
3636
}
3737
.write(&mut writer);
3838
assert_eq!(
39-
Err(asn1rs::io::per::Error::InvalidString(
39+
Err(asn1rs::io::per::ErrorKind::InvalidString(
4040
asn1rs::model::Charset::Visible,
4141
'\u{7F}',
4242
95
43-
)),
43+
)
44+
.into()),
4445
result
4546
)
4647
}

0 commit comments

Comments
 (0)