2022-11-02 03:48:19 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"testing"
|
2022-12-28 08:30:48 -08:00
|
|
|
|
2023-01-05 12:57:38 -08:00
|
|
|
"github.com/jandedobbeleer/oh-my-posh/src/cli"
|
2022-11-02 03:48:19 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkInit(b *testing.B) {
|
|
|
|
cmd := cli.RootCmd
|
2022-11-02 07:04:20 -07:00
|
|
|
// needs to be a non-existing file as we panic otherwise
|
2022-11-02 03:48:19 -07:00
|
|
|
cmd.SetArgs([]string{"init", "fish", "--print", "--config", "err.omp.json"})
|
|
|
|
out := bytes.NewBufferString("")
|
|
|
|
cmd.SetOut(out)
|
|
|
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
_ = cmd.Execute()
|
|
|
|
}
|
|
|
|
}
|
2022-11-02 07:04:20 -07:00
|
|
|
|
|
|
|
func BenchmarkPrimary(b *testing.B) {
|
|
|
|
cmd := cli.RootCmd
|
|
|
|
// needs to be a non-existing file as we panic otherwise
|
2022-11-02 07:57:30 -07:00
|
|
|
cmd.SetArgs([]string{"print", "primary", "--config", "err.omp.json", "--pwd", "/Users/jan/Code/oh-my-posh/src", "--shell", "fish"})
|
2022-11-02 07:04:20 -07:00
|
|
|
out := bytes.NewBufferString("")
|
|
|
|
cmd.SetOut(out)
|
|
|
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
_ = cmd.Execute()
|
|
|
|
}
|
|
|
|
}
|