Skip to content

Commit

Permalink
refinement: add some comment
Browse files Browse the repository at this point in the history
  • Loading branch information
SirZenith committed Jul 14, 2023
1 parent 10b72dc commit c84e558
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions ts.nu
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ def list-tests-in-file [file: path] {
open --raw $file
| to text
| lines
| do {|lines|
($lines | skip 1)
| zip $lines
| zip ($lines | skip 2)
| do {|x|
($x | skip 1) # target line
| zip $x # previous line of target line
| zip ($x | skip 2) # next line of target line
} $in
| each {|groups| $groups | flatten}
| filter {|group| $group.1 =~ "=+$" and $group.2 =~ "=+$"}
| each {|group| $group.0}
| each {|group| $group | flatten}
| filter {|g|
# check for test title surroundings on previous and next line
$g.1 =~ "=+$" and $g.2 =~ "=+$"
}
| each {|g| $g.0}
}

def list-tests-in-dir [dir: path] {
Expand Down

0 comments on commit c84e558

Please sign in to comment.