Debian Codegraph @

tests/codegen.rs

raw symbols SCIP
1 use instarust-analyzer cargo insta 1.43.1 crate/::assert_snapshotrust-analyzer cargo insta 1.43.1 macros/assert_snapshot!;
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#, pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#};
3
4 #[rstestrust-analyzer cargo rstest 0.26.1 crate/::rstestrust-analyzer cargo rstest_macros 0.26.1 rstest:]
5 #[case("simple")]
6 #[case("no_error_lut")]
7 #[case("skip_callback")]
8 #[case("skip_callback_failure")]
9 #[case("error_callback0")]
10 #[case("error_callback1")]
11 #[case("error_callback_failure")]
12 pub fn test_codegenrust-analyzer cargo logos-codegen 0.15.1 test_codegen().(#[case] fixture: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#>> {
13 let mut fixture_dir = PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]new().();
14 fixture_dir.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().(envrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/env!!("CARGO_MANIFEST_DIR"));
15 fixture_dir.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().("tests");
16 fixture_dir.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().("data");
17 fixture_dir.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().("codegen");
18 fixture_dir.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().(fixture);
19
20 let input = fixture_dir.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("input.rs");
21 let input = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::read_to_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_to_string().(input)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
22
23 let generated = logos_codegenrust-analyzer cargo logos-codegen 0.15.1 crate/::generaterust-analyzer cargo logos-codegen 0.15.1 generate().(input.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().).to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().();
24
25 if cfgrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/cfg!!(rust_1_82) {
26 assert_snapshotrust-analyzer cargo insta 1.43.1 macros/assert_snapshot!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{fixture}-1_82"), generated);
27 } else {
28 assert_snapshotrust-analyzer cargo insta 1.43.1 macros/assert_snapshot!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{fixture}-pre_1_82"), generated);
29 }
30
31 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
32 }