cmake_parser/doc/command/ctest/
ctest_upload.rs

1use cmake_parser_derive::CMake;
2
3use crate::{
4    doc::command_scope::{CommandScope, ToCommandScope},
5    Token,
6};
7
8/// Upload files to a dashboard server as a Dashboard Client.
9///
10/// Reference: <https://cmake.org/cmake/help/v3.26/command/ctest_upload.html>
11#[derive(CMake, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[cmake(pkg = "crate")]
13pub struct CTestUpload<'t> {
14    pub files: Vec<Token<'t>>,
15    pub capture_cmake_error: Option<Token<'t>>,
16    pub quiet: bool,
17}
18
19impl<'t> ToCommandScope for CTestUpload<'t> {
20    fn to_command_scope(&self) -> CommandScope {
21        CommandScope::CTest
22    }
23}
24
25#[cfg(test)]
26mod tests {
27    use super::*;
28    use crate::doc::cmake_parse::tests::{token, tokens_vec};
29    use crate::*;
30    use pretty_assertions::assert_eq;
31
32    #[test]
33    fn ctest_upload() {
34        let src = include_bytes!("../../../../../fixture/commands/ctest/ctest_upload");
35        let cmakelists = parse_cmakelists(src).unwrap();
36        let doc = Doc::from(cmakelists);
37        assert_eq!(
38            doc.commands(),
39            Ok(vec![Command::CTestUpload(Box::new(CTestUpload {
40                files: tokens_vec([b"file1", b"file2"]),
41                capture_cmake_error: Some(token(b"capture_cmake_error1")),
42                quiet: true,
43            })),])
44        )
45    }
46}