1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
use card::{
cell::Cell::*, ges::GesType::*, keyword::Keyword::*, line::Line::*, Card,
};
pub static GROUP: Card = Card {
lines: &[
Cells(&[Kw, Str(72)]),
OptionalBlock(b"META", b"END_META"),
Ges(GesNode),
],
ownfold: true,
keyword: Group,
};
pub static COMMENT: Card = Card {
lines: &[Cells(&[Fixed("#")])],
ownfold: false,
keyword: Comment,
};
#[cfg(test)]
mod tests {
use card::keyword::Keyword::*;
const CARD_GROUP: [&'static str; 7] = [
"GROUP / TitleOfTheGroup",
" ELE ",
" DELNOD ",
" PART 14 ",
" OGRP ",
" ELE ",
" END",
];
cardtest!(fold_group, CARD_GROUP, vec![(0, 6, Group)]);
const CARD_GROUP2: [&'static str; 11] = [
"GROUP / TitleOfTheGroup",
" ELE ",
" DELNOD ",
" PART 14 ",
" OGRP ",
" ELE ",
" END",
"GROUP / TitleOfTheGroup2",
" ELE ",
" ELE ",
" ELE ",
];
cardtest!(
fold_group2,
CARD_GROUP2,
vec![(0, 6, Group), (7, 10, Group)],
vec![(0, 10, Group)]
);
}