cmake_parser/doc/command/deprecated/
remove.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 Remove<'t> {
14 pub var: Token<'t>,
15 pub values: Vec<Token<'t>>,
16}
17
18impl<'t> ToCommandScope for Remove<'t> {
19 fn to_command_scope(&self) -> CommandScope {
20 CommandScope::Deprecated
21 }
22}
23
24#[cfg(test)]
25mod tests {
26 use super::*;
27 use crate::doc::cmake_parse::tests::{token, tokens_vec};
28 use crate::*;
29 use pretty_assertions::assert_eq;
30
31 #[test]
32 fn remove() {
33 let src = include_bytes!("../../../../../fixture/commands/deprecated/remove");
34 let cmakelists = parse_cmakelists(src).unwrap();
35 let doc = Doc::from(cmakelists);
36 assert_eq!(
37 doc.commands(),
38 Ok(vec![Command::Remove(Box::new(Remove {
39 var: token(b"var1"),
40 values: tokens_vec([b"value1", b"value2"]),
41 })),])
42 )
43 }
44}