Add test cases for the version number of dirty release versions

This commit is contained in:
Sebastian Messmer 2016-03-02 13:57:40 +01:00
parent 5753e4f71c
commit b7b7d47a8d

View File

@ -33,6 +33,17 @@ TEST(ParserTest, TestReleaseVersion_3) {
EXPECT_EQ("", info.versionTag);
}
TEST(ParserTest, TestDirtyReleaseVersion) {
VersionInfo info = Parser::parse("0.9.0+0.g5753e4f.dirty");
EXPECT_EQ("0", info.majorVersion);
EXPECT_EQ("9", info.minorVersion);
EXPECT_TRUE( info.isDevVersion);
EXPECT_FALSE( info.isStableVersion);
EXPECT_EQ("5753e4f", info.gitCommitId);
EXPECT_EQ("", info.versionTag);
}
TEST(ParserTest, TestDevVersion) {
VersionInfo info = Parser::parse("0.9.0+2.g0123abcdef");
EXPECT_EQ("0", info.majorVersion);
@ -63,6 +74,16 @@ TEST(ParserTest, TestReleaseVersion_StableTag) {
EXPECT_EQ("stable", info.versionTag);
}
TEST(ParserTest, TestDirtyReleaseVersion_StableTag) {
VersionInfo info = Parser::parse("0.9.0-stable+0.g5753e4f.dirty");
EXPECT_EQ("0", info.majorVersion);
EXPECT_EQ("9", info.minorVersion);
EXPECT_TRUE( info.isDevVersion);
EXPECT_FALSE( info.isStableVersion);
EXPECT_EQ("5753e4f", info.gitCommitId);
EXPECT_EQ("stable", info.versionTag);
}
TEST(ParserTest, TestDevVersion_StableTag) {
VersionInfo info = Parser::parse("0.9.0-stable+2.g0123abcdef");
EXPECT_EQ("0", info.majorVersion);
@ -93,6 +114,16 @@ TEST(ParserTest, TestReleaseVersion_AlphaTag) {
EXPECT_EQ("alpha", info.versionTag);
}
TEST(ParserTest, TestDirtyReleaseVersion_AlphaTag) {
VersionInfo info = Parser::parse("0.9.0-alpha+0.g5753e4f.dirty");
EXPECT_EQ("0", info.majorVersion);
EXPECT_EQ("9", info.minorVersion);
EXPECT_TRUE( info.isDevVersion);
EXPECT_FALSE( info.isStableVersion);
EXPECT_EQ("5753e4f", info.gitCommitId);
EXPECT_EQ("alpha", info.versionTag);
}
TEST(ParserTest, TestDevVersion_AlphaTag) {
VersionInfo info = Parser::parse("0.9.0-alpha+2.g0123abcdef");
EXPECT_EQ("0", info.majorVersion);
@ -123,6 +154,16 @@ TEST(ParserTest, TestReleaseVersion_RCTag) {
EXPECT_EQ("rc1", info.versionTag);
}
TEST(ParserTest, TestDirtyReleaseVersion_RCTag) {
VersionInfo info = Parser::parse("0.9.0-rc1+0.g5753e4f.dirty");
EXPECT_EQ("0", info.majorVersion);
EXPECT_EQ("9", info.minorVersion);
EXPECT_TRUE( info.isDevVersion);
EXPECT_FALSE( info.isStableVersion);
EXPECT_EQ("5753e4f", info.gitCommitId);
EXPECT_EQ("rc1", info.versionTag);
}
TEST(ParserTest, TestDevVersion_RCTag) {
VersionInfo info = Parser::parse("0.9.0-rc1+2.g0123abcdef");
EXPECT_EQ("0", info.majorVersion);
@ -143,4 +184,4 @@ TEST(ParserTest, TestDirtyDevVersion_RCTag) {
EXPECT_EQ("rc1", info.versionTag);
}
//TODO Dirty non-dev version
//TODO Dirty non-dev version 0.7.0+0.g5753e4f.dirty