Skip to content

Commit e42d198

Browse files
committed
wip: update verify
1 parent f5c6d39 commit e42d198

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

types/src/v17/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
//! | getchaintxstats | version + model | |
3838
//! | getdifficulty | version + model | |
3939
//! | getmempoolancestors | version + model | UNTESTED |
40-
//! | getmempooldescendants | version + model | Includes additional verbose type |
40+
//! | getmempooldescendants | version + model | Includes verbose type UNTESTED |
4141
//! | getmempoolentry | version + model | |
4242
//! | getmempoolinfo | version + model | |
4343
//! | getrawmempool | version + model | |
@@ -137,11 +137,11 @@
137137
//!
138138
//! | JSON-PRC Method Name | Returns | Notes |
139139
//! |:-----------------------------------|:---------------:|:--------------------------------------:|
140-
//! | createmultisig | version + model | |
141-
//! | estimatesmartfee | returns nothing | |
142-
//! | signmessagewithprivkey | returns string | |
143-
//! | validateaddress | version + model | |
144-
//! | verifymessage | returns boolean | |
140+
//! | createmultisig | version + model | TODO |
141+
//! | estimatesmartfee | returns nothing | TODO |
142+
//! | signmessagewithprivkey | returns string | TODO |
143+
//! | validateaddress | version + model | TODO |
144+
//! | verifymessage | returns boolean | TODO |
145145
//!
146146
//! </details>
147147
//!

verify/src/versioned.rs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,31 @@ pub fn methods_and_status(version: Version) -> Result<Vec<Method>> {
3434
.with_context(|| format!("Failed to grep rustdocs in {}", path.display()))?;
3535
let reader = io::BufReader::new(file);
3636

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();
3938

4039
let mut methods = Vec::new();
4140

4241
for line in reader.lines() {
4342
let line = line?;
4443

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+
4552
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 });
5062
}
5163
}
5264
Ok(methods)
@@ -122,10 +134,10 @@ impl FromStr for Status {
122134

123135
fn from_str(s: &str) -> Result<Self, Self::Err> {
124136
match s {
125-
"done" => Ok(Status::Done),
137+
"version" => Ok(Status::Done),
138+
"version + model" => Ok(Status::Done),
126139
"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),
129141
other => Err(anyhow::Error::msg(format!("unknown status: '{}'", other))),
130142
}
131143
}

0 commit comments

Comments
 (0)