Esempio n. 1
0
func (*kernelVersionSuite) TestMacOSXSeries(c *gc.C) {
	tests := []struct {
		version int
		series  string
	}{
		{13, "mavericks"},
		{12, "mountainlion"},
		{14, "unknown"},
		{4, "unknown"},
		{0, "unknown"},
	}
	for _, test := range tests {
		series := version.MacOSXSeriesFromMajorVersion(test.version)
		c.Check(series, gc.Equals, test.series)
	}
}
Esempio n. 2
0
func (*kernelVersionSuite) TestMacOSXSeries(c *gc.C) {
	tests := []struct {
		version int
		series  string
		err     string
	}{
		{version: 13, series: "mavericks"},
		{version: 12, series: "mountainlion"},
		{version: 14, series: "unknown", err: `unknown series ""`},
		{version: 4, series: "unknown", err: `unknown series ""`},
		{version: 0, series: "unknown", err: `unknown series ""`},
	}
	for _, test := range tests {
		series, err := version.MacOSXSeriesFromMajorVersion(test.version)
		if test.err != "" {
			c.Assert(err, gc.ErrorMatches, test.err)
		} else {
			c.Assert(err, gc.IsNil)
		}
		c.Check(series, gc.Equals, test.series)
	}
}