mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-14 23:14:05 -08:00
32 lines
795 B
Go
32 lines
795 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestDart(t *testing.T) {
|
|
cases := []struct {
|
|
Case string
|
|
ExpectedString string
|
|
Version string
|
|
}{
|
|
{Case: "Dart 2.12.4", ExpectedString: "2.12.4", Version: "Dart SDK version: 2.12.4 (stable) (Thu Apr 15 12:26:53 2021 +0200) on \"macos_x64\""},
|
|
}
|
|
for _, tc := range cases {
|
|
params := &mockedLanguageParams{
|
|
cmd: "dart",
|
|
versionParam: "--version",
|
|
versionOutput: tc.Version,
|
|
extension: "*.dart",
|
|
}
|
|
env, props := getMockedLanguageEnv(params)
|
|
d := &dart{}
|
|
d.init(props, env)
|
|
assert.True(t, d.enabled(), fmt.Sprintf("Failed in case: %s", tc.Case))
|
|
assert.Equal(t, tc.ExpectedString, d.string(), fmt.Sprintf("Failed in case: %s", tc.Case))
|
|
}
|
|
}
|