cmake_parser/doc/command/ctest/
ctest_read_custom_files.rs1use cmake_parser_derive::CMake;
2
3use crate::{
4 doc::command_scope::{CommandScope, ToCommandScope},
5 Token,
6};
7
8#[derive(CMake, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[cmake(pkg = "crate", positional)]
13pub struct CTestReadCustomFiles<'t> {
14 pub directories: Vec<Token<'t>>,
15}
16
17impl<'t> ToCommandScope for CTestReadCustomFiles<'t> {
18 fn to_command_scope(&self) -> CommandScope {
19 CommandScope::CTest
20 }
21}
22
23#[cfg(test)]
24mod tests {
25 use super::*;
26 use crate::doc::cmake_parse::tests::tokens_vec;
27 use crate::*;
28 use pretty_assertions::assert_eq;
29
30 #[test]
31 fn ctest_read_custom_files() {
32 let src = include_bytes!("../../../../../fixture/commands/ctest/ctest_read_custom_files");
33 let cmakelists = parse_cmakelists(src).unwrap();
34 let doc = Doc::from(cmakelists);
35 assert_eq!(
36 doc.commands(),
37 Ok(vec![Command::CTestReadCustomFiles(Box::new(
38 CTestReadCustomFiles {
39 directories: tokens_vec([b"dir1", b"dir2", b"dir3"]),
40 }
41 )),])
42 )
43 }
44}