blob: 58bf52f9a4a3ae82189383f1f1d1e8712501be99 (
plain)
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
|
/*!
Pulls a brief description out of a long description.
If the first paragraph of a long description is short enough then it
is interpreted as the brief description.
*/
use doc::ItemUtils;
pub fn mk_pass() -> Pass {
text_pass::mk_pass(~"trim", |s| str::trim(s) )
}
#[test]
fn should_trim_text() {
let doc = test::mk_doc(~"#[doc = \" desc \"] \
mod m {
#[legacy_exports]; }");
assert doc.cratemod().mods()[0].desc() == Some(~"desc");
}
#[cfg(test)]
mod test {
#[legacy_exports];
fn mk_doc(source: ~str) -> doc::Doc {
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv, ~"");
let doc = (attr_pass::mk_pass().f)(srv, doc);
(mk_pass().f)(srv, doc)
}
}
}
|