MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / user_function_name

Function user_function_name

cranelift/reader/src/parser.rs:3466–3512  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3464
3465 #[test]
3466 fn user_function_name() {
3467 // Valid characters in the name:
3468 let func = Parser::new(
3469 "function u1:2() system_v {
3470 block0:
3471 trap int_divz
3472 }",
3473 )
3474 .parse_function()
3475 .unwrap()
3476 .0;
3477 assert_eq!(func.name.to_string(), "u1:2");
3478
3479 // Invalid characters in the name:
3480 let mut parser = Parser::new(
3481 "function u123:abc() system_v {
3482 block0:
3483 trap stk_ovf
3484 }",
3485 );
3486 assert!(parser.parse_function().is_err());
3487
3488 // Incomplete function names should not be valid:
3489 let mut parser = Parser::new(
3490 "function u() system_v {
3491 block0:
3492 trap int_ovf
3493 }",
3494 );
3495 assert!(parser.parse_function().is_err());
3496
3497 let mut parser = Parser::new(
3498 "function u0() system_v {
3499 block0:
3500 trap int_ovf
3501 }",
3502 );
3503 assert!(parser.parse_function().is_err());
3504
3505 let mut parser = Parser::new(
3506 "function u0:() system_v {
3507 block0:
3508 trap int_ovf
3509 }",
3510 );
3511 assert!(parser.parse_function().is_err());
3512 }
3513
3514 #[test]
3515 fn change_default_calling_convention() {

Callers

nothing calls this directly

Calls 3

parse_functionMethod · 0.80
newFunction · 0.50
unwrapMethod · 0.45

Tested by

no test coverage detected