pkg/parsers: add unit test for Darwin

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-07-14 14:02:54 +02:00
parent d78b22cdf5
commit 818e0b2fcf
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
package kernel
import (
"testing"
"gotest.tools/v3/assert"
)
func TestGetRelease(t *testing.T) {
// example output of "system_profiler SPSoftwareDataType"
const spSoftwareDataType = `Software:
System Software Overview:
System Version: macOS 10.14.6 (18G4032)
Kernel Version: Darwin 18.7.0
Boot Volume: fastfood
Boot Mode: Normal
Computer Name: Macintosh
User Name: Foobar (foobar)
Secure Virtual Memory: Enabled
System Integrity Protection: Enabled
Time since boot: 6 days 23:16
`
release, err := getRelease(spSoftwareDataType)
assert.NilError(t, err)
assert.Equal(t, release, "18.7.0")
}