Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hkctkuy committed Dec 8, 2024
1 parent d4606fd commit 0171139
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions libcasr/src/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ impl ParseStacktrace for LuaStacktrace {
fn extract_stacktrace(stream: &str) -> Result<Vec<String>> {
let stacktrace = stream
.split('\n')
.map(|l| l.to_string())
.map(|l| l.trim().to_string())
.collect::<Vec<String>>();
let Some(first) = stacktrace
.iter()
.position(|line| line.trim().ends_with("stack traceback:"))
.position(|line| line.ends_with("stack traceback:"))
else {
return Err(Error::Casr(
"Couldn't find traceback in lua report".to_string(),
));

Check warning on line 57 in libcasr/src/lua.rs

View check run for this annotation

Codecov / codecov/patch

libcasr/src/lua.rs#L55-L57

Added lines #L55 - L57 were not covered by tests
};

let re = Regex::new(r#".+:(?:|\d+:) in .+"#).unwrap();
let re = Regex::new(r#".+: in .+"#).unwrap();
Ok(stacktrace[first..]
.iter()
.map(|s| s.trim().to_string())
.map(|s| s.to_string())
.filter(|s| re.is_match(s))
.collect::<Vec<String>>())
}
Expand Down Expand Up @@ -95,10 +95,7 @@ impl ParseStacktrace for LuaStacktrace {
};
if let Some(appendix) = cap.get(3) {
let appendix = appendix.as_str().to_string();
if !appendix.starts_with("function")
&& !appendix.starts_with("upvalue")
&& !appendix.starts_with("local")
{
if appendix.starts_with("main") {
stentry.function = appendix + &stentry.function;
}
}

Check warning on line 101 in libcasr/src/lua.rs

View check run for this annotation

Codecov / codecov/patch

libcasr/src/lua.rs#L101

Added line #L101 was not covered by tests
Expand Down

0 comments on commit 0171139

Please sign in to comment.