()
| 3357 | |
| 3358 | #[test] |
| 3359 | fn comments() { |
| 3360 | let (func, Details { comments, .. }) = Parser::new( |
| 3361 | "; before |
| 3362 | function %comment() system_v { ; decl |
| 3363 | ss10 = explicit_slot 13 ; stackslot. |
| 3364 | ; Still stackslot. |
| 3365 | block0: ; Basic block |
| 3366 | trap user42; Instruction |
| 3367 | } ; Trailing. |
| 3368 | ; More trailing.", |
| 3369 | ) |
| 3370 | .parse_function() |
| 3371 | .unwrap(); |
| 3372 | assert_eq!(func.name.to_string(), "%comment"); |
| 3373 | assert_eq!(comments.len(), 7); // no 'before' comment. |
| 3374 | assert_eq!( |
| 3375 | comments[0], |
| 3376 | Comment { |
| 3377 | entity: AnyEntity::Function, |
| 3378 | text: "; decl", |
| 3379 | } |
| 3380 | ); |
| 3381 | assert_eq!(comments[1].entity.to_string(), "ss10"); |
| 3382 | assert_eq!(comments[2].entity.to_string(), "ss10"); |
| 3383 | assert_eq!(comments[2].text, "; Still stackslot."); |
| 3384 | assert_eq!(comments[3].entity.to_string(), "block0"); |
| 3385 | assert_eq!(comments[3].text, "; Basic block"); |
| 3386 | |
| 3387 | assert_eq!(comments[4].entity.to_string(), "inst0"); |
| 3388 | assert_eq!(comments[4].text, "; Instruction"); |
| 3389 | |
| 3390 | assert_eq!(comments[5].entity, AnyEntity::Function); |
| 3391 | assert_eq!(comments[6].entity, AnyEntity::Function); |
| 3392 | } |
| 3393 | |
| 3394 | #[test] |
| 3395 | fn test_file() { |
nothing calls this directly
no test coverage detected