Path: blob/main/cranelift/filetests/src/test_cat.rs
1691 views
//! The `cat` subtest.12use crate::subtest::{self, Context, SubTest};3use cranelift_codegen::ir::Function;4use cranelift_reader::TestCommand;5use std::borrow::Cow;67/// Object implementing the `test cat` sub-test.8///9/// This command is used for testing the parser and function printer. It simply parses a function10/// and prints it out again.11///12/// The result is verified by filecheck.13struct TestCat;1415pub fn subtest(parsed: &TestCommand) -> anyhow::Result<Box<dyn SubTest>> {16assert_eq!(parsed.command, "cat");17if !parsed.options.is_empty() {18anyhow::bail!("No options allowed on {}", parsed);19}20Ok(Box::new(TestCat))21}2223impl SubTest for TestCat {24fn name(&self) -> &'static str {25"cat"26}2728fn needs_verifier(&self) -> bool {29false30}3132fn run(&self, func: Cow<Function>, context: &Context) -> anyhow::Result<()> {33subtest::run_filecheck(&func.display().to_string(), context)34}35}363738