-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from nlamirault/develop
Release 0.10.0
- Loading branch information
Showing
7 changed files
with
168 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,10 @@ | |
|
||
;; Author: Nicolas Lamirault <[email protected]> | ||
;; URL: https://github.com/nlamirault/gotest.el | ||
;; Version: 0.9.0 | ||
;; Version: 0.10.0 | ||
;; Keywords: languages, go, tests | ||
|
||
;; Package-Requires: ((emacs "24.3") (s "1.10.0") (f "0.18.0") (go-mode "1.3.1")) | ||
;; Package-Requires: ((emacs "24.3") (s "1.11.0") (f "0.17.3") (go-mode "1.3.1")) | ||
|
||
;; Copyright (C) 2014, 2015 Nicolas Lamirault <[email protected]> | ||
|
||
|
@@ -321,6 +321,19 @@ For example, if the current buffer is `foo.go', the buffer for | |
(go-test--get-current-file-data "Example")) | ||
|
||
|
||
(defun go-test--get-current-file-testing-data () | ||
"Regex with unit test and|or examples." | ||
(let ((tests (go-test--get-current-file-tests)) | ||
(examples (go-test--get-current-file-examples))) | ||
(cond ((and (> (length tests) 0) | ||
(> (length examples) 0)) | ||
(s-concat tests "|" examples)) | ||
((= (length tests) 0) | ||
examples) | ||
((= (length examples) 0) | ||
tests)))) | ||
|
||
|
||
(defun go-test--arguments (args) | ||
"Make the go test command argurments using `ARGS'." | ||
(let ((opts args)) | ||
|
@@ -436,11 +449,7 @@ For example, if the current buffer is `foo.go', the buffer for | |
(defun go-test-current-file () | ||
"Launch go test on the current buffer file." | ||
(interactive) | ||
(let* ((tests (go-test--get-current-file-tests)) | ||
(examples (go-test--get-current-file-examples)) | ||
(data (if (> (length examples) 0) | ||
(s-concat tests "|" examples) | ||
tests))) | ||
(let ((data (go-test--get-current-file-testing-data))) | ||
(if (go-test--is-gb-project) | ||
(go-test--gb-start (s-concat "-test.v=true -test.run='" data "'")) | ||
(go-test--go-test (s-concat "-run='" data "'"))))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
func TestFoo(t *testing.T) { | ||
t.Log("logFoo") | ||
} | ||
|
||
func TestBar(t *testing.T) { | ||
t.Log("logBar") | ||
} | ||
|
||
func Test_Baz(t *testing.T) { | ||
t.Log("log_Baz") | ||
} | ||
|
||
func ExampleA() { | ||
fmt.Println("Example A") | ||
// Output: Example A | ||
} | ||
|
||
func ExampleB() { | ||
fmt.Println("Example B") | ||
// Output: Example B | ||
} | ||
|
||
func ExampleC() { | ||
fmt.Println("Example C") | ||
// Output: Example C | ||
} | ||
|
||
func BenchmarkHello(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
fmt.Println("hello") | ||
} | ||
} | ||
|
||
func BenchmarkHelloWorld(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
fmt.Println("hello world") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
func ExampleA() { | ||
fmt.Println("Example A") | ||
// Output: Example A | ||
} | ||
|
||
func ExampleB() { | ||
fmt.Println("Example B") | ||
// Output: Example B | ||
} | ||
|
||
func ExampleC() { | ||
fmt.Println("Example C") | ||
// Output: Example C | ||
} | ||
|
||
func BenchmarkHello(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
fmt.Println("hello") | ||
} | ||
} | ||
|
||
func BenchmarkHelloWorld(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
fmt.Println("hello world") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
func TestA(t *testing.T) { | ||
fmt.Println("test a") | ||
} | ||
|
||
func TestB(t *testing.T) { | ||
fmt.Println("test b") | ||
} | ||
|
||
func TestAB(t *testing.T) { | ||
fmt.Println("test ab") | ||
} | ||
|
||
func BenchmarkHello(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
fmt.Println("hello") | ||
} | ||
} | ||
|
||
func BenchmarkHelloWorld(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
fmt.Println("hello world") | ||
} | ||
} |