cmake_parser/doc/command/deprecated/
build_name.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")]
13pub struct BuildName<'t> {
14 #[cmake(positional)]
15 pub variable: Token<'t>,
16}
17
18impl<'t> ToCommandScope for BuildName<'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;
28 use crate::*;
29 use pretty_assertions::assert_eq;
30
31 #[test]
32 fn build_name() {
33 let src = include_bytes!("../../../../../fixture/commands/deprecated/build_name");
34 let cmakelists = parse_cmakelists(src).unwrap();
35 let doc = Doc::from(cmakelists);
36 assert_eq!(
37 doc.commands(),
38 Ok(vec![Command::BuildName(Box::new(BuildName {
39 variable: token(b"variable1"),
40 })),])
41 )
42 }
43}