Skip to content

Commit

Permalink
Make it possible to run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xyproto committed Jul 22, 2024
1 parent e99e971 commit fd4cf89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## General

- [ ] Run a specific test if the cursor is within a test function when double ctrl-space is pressed.
- [ ] Change the cursor color when it is past 80 lines (or the set wrap width).
- [ ] Let the status bar be toggled by the ctrl-o menu. Let ctrl-g when not on a definition do something useful, like cycle indenting a block 0 to 7 indentations.
- [ ] When opening `file.txt+7`, only assume that 7 is the line number if no file named `file.txt+7` exists, but `file.txt` exists.
Expand Down
7 changes: 6 additions & 1 deletion v2/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ func (e *Editor) Run() (string, bool, error) {
jarName := e.exeName(sourceFilename, false) + ".jar"
cmd = exec.Command("java", "-jar", jarName)
case mode.Go:
cmd = exec.Command("go", "run", sourceFilename)
if strings.HasSuffix(sourceFilename, "_test.go") {
// TODO: go test . -run NameOfTest and fetch NameOfTest from the test function that the cursor is within, if available
cmd = exec.Command("go", "test", ".")
} else {
cmd = exec.Command("go", "run", sourceFilename)
}
case mode.Lilypond:
ext := filepath.Ext(sourceFilename)
firstName := strings.TrimSuffix(filepath.Base(sourceFilename), ext)
Expand Down

0 comments on commit fd4cf89

Please sign in to comment.