aboutsummaryrefslogtreecommitdiff
path: root/formatter_bench_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'formatter_bench_test.go')
-rw-r--r--formatter_bench_test.go49
1 files changed, 0 insertions, 49 deletions
diff --git a/formatter_bench_test.go b/formatter_bench_test.go
deleted file mode 100644
index 0820a10..0000000
--- a/formatter_bench_test.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package main
-
-import (
- "strings"
- "testing"
-)
-
-func BenchmarkFormatSmall(b *testing.B) {
- inputSource := []byte(`package main
-func main() {
- x := 1
- y := 2
- if x > 0 {
- z := 3
- }
- a := 4
-}
-`)
- formatter := &Formatter{CommentMode: CommentsFollow}
-
- for b.Loop() {
- _, _ = formatter.Format(inputSource)
- }
-}
-
-func BenchmarkFormatLarge(b *testing.B) {
- var sourceBuilder strings.Builder
-
- sourceBuilder.WriteString("package main\n\n")
-
- for functionIndex := range 100 {
- sourceBuilder.WriteString("func foo")
- sourceBuilder.WriteString(string(rune('A' + functionIndex%26)))
- sourceBuilder.WriteString("() {\n")
- sourceBuilder.WriteString("\tx := 1\n")
- sourceBuilder.WriteString("\tif x > 0 {\n")
- sourceBuilder.WriteString("\t\ty := 2\n")
- sourceBuilder.WriteString("\t}\n")
- sourceBuilder.WriteString("\tz := 3\n")
- sourceBuilder.WriteString("}\n\n")
- }
-
- inputSource := []byte(sourceBuilder.String())
- formatter := &Formatter{CommentMode: CommentsFollow}
-
- for b.Loop() {
- _, _ = formatter.Format(inputSource)
- }
-}