cmake_parser/doc/command/scripting/
continue.rs

1use cmake_parser_derive::CMake;
2
3use crate::doc::command_scope::{CommandScope, ToCommandScope};
4
5/// Continue to the top of enclosing foreach or while loop.
6///
7/// Reference: <https://cmake.org/cmake/help/v3.26/command/continue.html>
8#[derive(CMake, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
9#[cmake(pkg = "crate")]
10pub struct Continue;
11
12impl ToCommandScope for Continue {
13    fn to_command_scope(&self) -> CommandScope {
14        CommandScope::Scripting
15    }
16}
17
18#[cfg(test)]
19mod tests {
20    use super::*;
21    use crate::*;
22    use pretty_assertions::assert_eq;
23
24    #[test]
25    fn r#continue() {
26        let src = include_bytes!("../../../../../fixture/commands/scripting/continue");
27        let cmakelists = parse_cmakelists(src).unwrap();
28        let doc = Doc::from(cmakelists);
29        assert_eq!(
30            doc.commands(),
31            Ok(vec![Command::Continue(Box::new(Continue)),])
32        )
33    }
34}