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

Function test_file

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

Source from the content-addressed store, hash-verified

3393
3394 #[test]
3395 fn test_file() {
3396 let tf = parse_test(
3397 r#"; before
3398 test cfg option=5
3399 test verify
3400 set unwind_info=false
3401 feature "foo"
3402 feature !"bar"
3403 ; still preamble
3404 function %comment() system_v {}"#,
3405 ParseOptions::default(),
3406 )
3407 .unwrap();
3408 assert_eq!(tf.commands.len(), 2);
3409 assert_eq!(tf.commands[0].command, "cfg");
3410 assert_eq!(tf.commands[1].command, "verify");
3411 match tf.isa_spec {
3412 IsaSpec::None(s) => {
3413 assert!(s.enable_verifier());
3414 assert!(!s.unwind_info());
3415 }
3416 _ => panic!("unexpected ISAs"),
3417 }
3418 assert_eq!(tf.features[0], Feature::With(&"foo"));
3419 assert_eq!(tf.features[1], Feature::Without(&"bar"));
3420 assert_eq!(tf.preamble_comments.len(), 2);
3421 assert_eq!(tf.preamble_comments[0].text, "; before");
3422 assert_eq!(tf.preamble_comments[1].text, "; still preamble");
3423 assert_eq!(tf.functions.len(), 1);
3424 assert_eq!(tf.functions[0].0.name.to_string(), "%comment");
3425 }
3426
3427 #[test]
3428 fn isa_spec() {

Callers

nothing calls this directly

Calls 2

parse_testFunction · 0.85
unwrapMethod · 0.45

Tested by

no test coverage detected