diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/function.rs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/tests/function.rs b/tests/function.rs index e0cda3e..bc99ec0 100644 --- a/tests/function.rs +++ b/tests/function.rs @@ -135,34 +135,37 @@ fn test_function_info() -> Result<()> { let function1_info = function1.info(); #[cfg(feature = "luau")] - assert_eq!(function1_info.name, Some(b"function1".to_vec())); - assert_eq!(function1_info.source, Some(b"source1".to_vec())); + assert_eq!(function1_info.name.as_deref(), Some("function1")); + assert_eq!(function1_info.source.as_deref(), Some(b"source1".as_ref())); assert_eq!(function1_info.line_defined, 2); #[cfg(not(feature = "luau"))] assert_eq!(function1_info.last_line_defined, 4); - assert_eq!(function1_info.what, Some(b"Lua".to_vec())); + #[cfg(feature = "luau")] + assert_eq!(function1_info.last_line_defined, -1); + assert_eq!(function1_info.what.as_deref(), Some("Lua")); let function2_info = function2.info(); assert_eq!(function2_info.name, None); - assert_eq!(function2_info.source, Some(b"source1".to_vec())); + assert_eq!(function2_info.source.as_deref(), Some(b"source1".as_ref())); assert_eq!(function2_info.line_defined, 3); #[cfg(not(feature = "luau"))] assert_eq!(function2_info.last_line_defined, 3); - assert_eq!(function2_info.what, Some(b"Lua".to_vec())); + #[cfg(feature = "luau")] + assert_eq!(function2_info.last_line_defined, -1); + assert_eq!(function2_info.what.as_deref(), Some("Lua")); let function3_info = function3.info(); assert_eq!(function3_info.name, None); - assert_eq!(function3_info.source, Some(b"=[C]".to_vec())); + assert_eq!(function3_info.source.as_deref(), Some(b"=[C]".as_ref())); assert_eq!(function3_info.line_defined, -1); - #[cfg(not(feature = "luau"))] assert_eq!(function3_info.last_line_defined, -1); - assert_eq!(function3_info.what, Some(b"C".to_vec())); + assert_eq!(function3_info.what.as_deref(), Some("C")); let print_info = globals.get::<_, Function>("print")?.info(); #[cfg(feature = "luau")] - assert_eq!(print_info.name, Some(b"print".to_vec())); - assert_eq!(print_info.source, Some(b"=[C]".to_vec())); - assert_eq!(print_info.what, Some(b"C".to_vec())); + assert_eq!(print_info.name.as_deref(), Some("print")); + assert_eq!(print_info.source.as_deref(), Some(b"=[C]".as_ref())); + assert_eq!(print_info.what.as_deref(), Some("C")); assert_eq!(print_info.line_defined, -1); Ok(()) |