MCPcopy Create free account
hub / github.com/astonbitecode/j4rs / test_char_array_to_rust

Function test_char_array_to_rust

rust/src/api/mod.rs:2303–2320  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2301
2302 #[test]
2303 fn test_char_array_to_rust() -> errors::Result<()> {
2304 let jvm = create_tests_jvm()?;
2305 let rust_value: Vec<u16> = vec![3_u16, 7_u16, 10000_u16];
2306 let ia: Vec<_> = rust_value
2307 .iter()
2308 .map(|x| {
2309 InvocationArg::try_from(x)
2310 .unwrap()
2311 .into_primitive()
2312 .unwrap()
2313 })
2314 .collect();
2315 let java_instance = jvm.create_java_array(PRIMITIVE_CHAR, &ia)?;
2316 let rust_value_from_java: Vec<u16> = jvm.to_rust(java_instance)?;
2317 assert_eq!(rust_value_from_java, rust_value);
2318
2319 Ok(())
2320 }
2321
2322 #[test]
2323 fn test_int_array_to_rust() -> errors::Result<()> {

Callers

nothing calls this directly

Calls 6

create_tests_jvmFunction · 0.85
collectMethod · 0.80
mapMethod · 0.80
into_primitiveMethod · 0.80
create_java_arrayMethod · 0.80
to_rustMethod · 0.45

Tested by

no test coverage detected