Skip to content

Commit e33bcf7

Browse files
committed
Add Lua 5.5 external string null byte test
1 parent c80a97b commit e33bcf7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/string.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,18 @@ fn test_bytes_into_iter() -> Result<()> {
157157

158158
Ok(())
159159
}
160+
161+
#[cfg(feature = "lua55")]
162+
#[test]
163+
fn test_external_string() -> Result<()> {
164+
let lua = Lua::new();
165+
166+
let s = lua.create_external_string(b"abc\0")?;
167+
assert_eq!(
168+
s.as_bytes(),
169+
b"abc\0",
170+
"Trailing null byte should be preserved if present explicitly"
171+
);
172+
173+
Ok(())
174+
}

0 commit comments

Comments
 (0)