File: bytes.rs

package info (click to toggle)
rust-magnus 0.8.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,756 kB
  • sloc: ruby: 150; sh: 17; makefile: 2
file content (11 lines) | stat: -rw-r--r-- 298 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
#![cfg(all(feature = "bytes", feature = "embed"))]

#[test]
fn it_converts_to_bytes() {
    use magnus::RString;

    let ruby = unsafe { magnus::embed::init() };

    let s: RString = ruby.eval("[0,0,0].pack('c*')").unwrap();
    assert_eq!(bytes::Bytes::from_static(&[0, 0, 0]), s.to_bytes());
}