Skip to content

Commit 59de781

Browse files
committed
format
1 parent d6ca54c commit 59de781

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/lib.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@
3939
use regex::Regex;
4040
use similar::TextDiff;
4141

42-
use std::{fs, io::{self, BufRead, BufReader}, path::Path, sync::LazyLock};
42+
use std::{
43+
fs,
44+
io::{self, BufRead, BufReader},
45+
path::Path,
46+
sync::LazyLock,
47+
};
4348

4449
static LISTINGS: LazyLock<Regex> = LazyLock::new(|| {
4550
Regex::new(r"(?m)^```.*?\n(?<code>[^`]+?\n)?```\n\(\[(?<title>[\s\S]+?)\]\((?<link>.*?)\)")
@@ -138,7 +143,7 @@ mod tests {
138143
let want = " foo\n bar\n baz\n";
139144
assert_eq!(indent(input), want, "wrong indentation");
140145
}
141-
146+
142147
#[test]
143148
fn diff_matches_indented_code() {
144149
let local = "#[test]\nfn foo() {}";

tests/data/test.md

+15
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,18 @@ fn append_appends_line_to_existing_file() {
1313
}
1414
```
1515
([Listing `logbook_4`](https://github.com/bitfield/tsr-tools/blob/main/logbook_4/src/lib.rs))
16+
17+
Just as a refresher, here's the existing test for `count_lines` (we won't worry about the error-handling test for now):
18+
19+
\vspace{5pt}
20+
```rust
21+
#[test]
22+
fn count_lines_fn_counts_lines_in_input() {
23+
let input = Cursor::new("line 1\nline 2\n");
24+
let lines = count_lines(input);
25+
assert_eq!(lines, 2, "wrong line count");
26+
}
27+
```
28+
([Listing `count_2`](https://github.com/bitfield/tsr-tools/blob/main/count_2/src/lib.rs))
29+
30+
So, over to you again.

0 commit comments

Comments
 (0)