mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-03 15:27:26 -08:00
30 lines
673 B
Go
30 lines
673 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestMemory(t *testing.T) {
|
||
|
cases := []struct {
|
||
|
Case string
|
||
|
ExpectedString string
|
||
|
Memory memory
|
||
|
Precision int
|
||
|
}{
|
||
|
{Case: "50", ExpectedString: "50", Memory: memory{FreeMemory: 50, TotalMemory: 100}},
|
||
|
{Case: "50.0", ExpectedString: "50.0", Memory: memory{FreeMemory: 50, TotalMemory: 100}, Precision: 1},
|
||
|
}
|
||
|
|
||
|
for _, tc := range cases {
|
||
|
tc.Memory.env = new(MockedEnvironment)
|
||
|
tc.Memory.props = &properties{
|
||
|
values: map[Property]interface{}{
|
||
|
Precision: tc.Precision,
|
||
|
},
|
||
|
}
|
||
|
assert.Equal(t, tc.ExpectedString, tc.Memory.string(), tc.Case)
|
||
|
}
|
||
|
}
|