Explorar o código

add test for u64 len

deltanedas %!s(int64=2) %!d(string=hai) anos
pai
achega
527db65c0a
Modificáronse 1 ficheiros con 12 adicións e 0 borrados
  1. 12 0
      src/tests.rs

+ 12 - 0
src/tests.rs

@@ -278,3 +278,15 @@ fn ignored_unnamed_fields() -> Result<()> {
 
 	Ok(())
 }
+
+#[test]
+fn u64_len() -> Result<()> {
+	#[derive(Io)]
+	struct Big(#[io(len(u64))] Vec<u8>);
+
+	let big = Big(vec![]);
+	let bytes = big.to_bytes()?;
+	assert_eq!(bytes, b"\x00\x00\x00\x00\x00\x00\x00\x00");
+
+	Ok(())
+}