-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into BAF-805/aarch64
- Loading branch information
Showing
6 changed files
with
86 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package main | ||
|
||
import "testing" | ||
|
||
func lsb_release_test(distId string, relNumber string, validate bool, file string, t *testing.T) { | ||
data := DataStruct{} | ||
|
||
data.ReadFromFile(file, validate) | ||
if data.DistributorID != distId { | ||
t.Errorf("Distributor ID is not %s", distId) | ||
} | ||
if data.ReleaseNumber != relNumber { | ||
t.Errorf("Release number is not %s", relNumber) | ||
} | ||
} | ||
|
||
func Test_lsb_release_multipledigit(t *testing.T) { | ||
lsb_release_test("Ubuntu", "18.04", false, "test_data/lsb_release_ubuntu1804.txt", t) | ||
} | ||
|
||
func Test_lsb_release_digit(t *testing.T) { | ||
lsb_release_test("Debian", "11", false, "test_data/lsb_release.txt", t) | ||
} | ||
|
||
func Test_lsb_release_validate_ok(t *testing.T) { | ||
lsb_release_test("Debian", "11", true, "test_data/lsb_release.txt", t) | ||
lsb_release_test("Ubuntu", "18.04", true, "test_data/lsb_release_ubuntu1804.txt", t) | ||
} | ||
|
||
func Test_lsb_release_validate_notok(t *testing.T) { | ||
defer func() { | ||
if r := recover(); r == nil { | ||
t.Errorf("The code did not panic") | ||
} | ||
}() | ||
lsb_release_test("Debian", "11", true, "test_data/lsb_release_broken.txt", t) | ||
} | ||
|
||
func Test_lsb_release_validate_notok_nopanic(t *testing.T) { | ||
data := DataStruct{} | ||
data.ReadFromFile("test_data/lsb_release_broken.txt", false) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Distributor ID: Debian | ||
Release: 11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Distributor ID : Debian | ||
Release: 11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Distributor ID: Ubuntu | ||
Description: Ubuntu GNU/Linux 18.04 (Bionic Beaver) | ||
Release: 18.04 | ||
Codename: Bionic Beaver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
version=0.3.0 | ||
version=0.3.2 |