cmake_parser/doc/command/ctest/
ctest_start.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", default = "model")]
13pub struct CTestStart<'t> {
14 #[cmake(rename = "")]
15 pub model: Option<Model<'t>>,
16 pub group: Option<Token<'t>>,
17 pub append: bool,
18 pub quiet: bool,
19}
20
21impl<'t> ToCommandScope for CTestStart<'t> {
22 fn to_command_scope(&self) -> CommandScope {
23 CommandScope::CTest
24 }
25}
26
27#[derive(CMake, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
28#[cmake(pkg = "crate", positional)]
29pub struct Model<'t> {
30 pub model: Token<'t>,
31 pub source: Option<Token<'t>>,
32 pub binary: Option<Token<'t>>,
33}
34
35#[cfg(test)]
36mod tests {
37 use super::*;
38 use crate::doc::cmake_parse::tests::token;
39 use crate::*;
40 use pretty_assertions::assert_eq;
41
42 #[test]
43 fn ctest_start() {
44 let src = include_bytes!("../../../../../fixture/commands/ctest/ctest_start");
45 let cmakelists = parse_cmakelists(src).unwrap();
46 let doc = Doc::from(cmakelists);
47 assert_eq!(
48 doc.commands(),
49 Ok(vec![
50 Command::CTestStart(Box::new(CTestStart {
51 model: Some(Model {
52 model: token(b"Experimental"),
53 source: None,
54 binary: None,
55 }),
56 group: Some(token(b"GroupExperimental")),
57 append: false,
58 quiet: false,
59 })),
60 Command::CTestStart(Box::new(CTestStart {
61 model: None,
62 group: None,
63 append: true,
64 quiet: false,
65 })),
66 Command::CTestStart(Box::new(CTestStart {
67 model: Some(Model {
68 model: token(b"Experimental"),
69 source: Some(token(b"path/to/source")),
70 binary: Some(token(b"path/to/binary")),
71 }),
72 group: Some(token(b"SomeGroup")),
73 append: true,
74 quiet: true,
75 })),
76 Command::CTestStart(Box::new(CTestStart {
77 model: Some(Model {
78 model: token(b"Experimental"),
79 source: Some(token(b"path/to/source")),
80 binary: Some(token(b"path/to/binary")),
81 }),
82 group: Some(token(b"SomeGroup")),
83 append: true,
84 quiet: true,
85 })),
86 Command::CTestStart(Box::new(CTestStart {
87 model: Some(Model {
88 model: token(b"Experimental"),
89 source: Some(token(b"path/to/source")),
90 binary: Some(token(b"path/to/binary")),
91 }),
92 group: Some(token(b"SomeGroup")),
93 append: true,
94 quiet: true,
95 })),
96 ])
97 )
98 }
99}