@@ -34,19 +34,31 @@ pub fn methods_and_status(version: Version) -> Result<Vec<Method>> {
34
34
. with_context ( || format ! ( "Failed to grep rustdocs in {}" , path. display( ) ) ) ?;
35
35
let reader = io:: BufReader :: new ( file) ;
36
36
37
- // let re = Regex::new(r"\/\/\! \| ([a-z]+) \| ([.*?]) \|").unwrap();
38
- let re = Regex :: new ( r"\/\/\! \| ([a-z]+) .* \| ([a-z ()]+?) \|" ) . unwrap ( ) ;
37
+ let re = Regex :: new ( r"\/\/\! \| ([a-z]+) .* \| ([a-z +]+?) \|.*\|" ) . unwrap ( ) ;
39
38
40
39
let mut methods = Vec :: new ( ) ;
41
40
42
41
for line in reader. lines ( ) {
43
42
let line = line?;
44
43
44
+ let override_status = if line. contains ( "UNTESTED" ) {
45
+ Some ( Status :: Untested )
46
+ } else if line. contains ( "TODO" ) {
47
+ Some ( Status :: Todo )
48
+ } else {
49
+ None
50
+ } ;
51
+
45
52
if let Some ( caps) = re. captures ( & line) {
46
- let name = caps. get ( 1 ) . unwrap ( ) . as_str ( ) ;
47
- let status = caps. get ( 2 ) . unwrap ( ) . as_str ( ) ;
48
- let status = status. trim ( ) . parse :: < Status > ( ) ?;
49
- methods. push ( Method { name : name. to_string ( ) , status } ) ;
53
+ let method_name = caps. get ( 1 ) . unwrap ( ) . as_str ( ) ;
54
+ let returns_column = caps. get ( 2 ) . unwrap ( ) . as_str ( ) ;
55
+
56
+ let status = match override_status {
57
+ Some ( status) => status,
58
+ None => returns_column. trim ( ) . parse :: < Status > ( ) ?,
59
+ } ;
60
+
61
+ methods. push ( Method { name : method_name. to_string ( ) , status } ) ;
50
62
}
51
63
}
52
64
Ok ( methods)
@@ -122,10 +134,10 @@ impl FromStr for Status {
122
134
123
135
fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
124
136
match s {
125
- "done" => Ok ( Status :: Done ) ,
137
+ "version" => Ok ( Status :: Done ) ,
138
+ "version + model" => Ok ( Status :: Done ) ,
126
139
"omitted" => Ok ( Status :: Omitted ) ,
127
- "done (untested)" => Ok ( Status :: Untested ) ,
128
- "todo" => Ok ( Status :: Todo ) ,
140
+ "returns nothing" | "returns numeric" | "returns boolean" | "returns string" => Ok ( Status :: Done ) ,
129
141
other => Err ( anyhow:: Error :: msg ( format ! ( "unknown status: '{}'" , other) ) ) ,
130
142
}
131
143
}
0 commit comments