Ejemplo n.º 1
0
    def test_output_cpp_with_version_info_with_leading_zero(self):
        expected = """
                // ---------------------------------------------------
                // This file is autogenerated by git-version.
                // DO NOT MODIFY!
                // ---------------------------------------------------

                #pragma once
                #ifndef MESSMER_GITVERSION_VERSION_H
                #define MESSMER_GITVERSION_VERSION_H

                namespace version {
                    constexpr const char *VERSION_STRING = "1.06.dev2+rev230a";
                    constexpr const char *GIT_TAG_NAME = "1.06";
                    constexpr const unsigned int GIT_COMMITS_SINCE_TAG = 2;
                    constexpr const char *GIT_COMMIT_ID = "230a";
                    constexpr bool MODIFIED_SINCE_COMMIT = false;
                    constexpr bool IS_DEV_VERSION = true;
                    constexpr bool IS_STABLE_VERSION = false;

                    constexpr const char *VERSION_COMPONENTS[] = {"1", "06"};
                    constexpr const char *VERSION_TAG = "";
                }

                #endif
            """
        actual = versioninfooutputter.to_cpp(versioninfo.VersionInfo("1.06", 2, "230a", True, False))
        self.assertCodeEqual(expected, actual)
Ejemplo n.º 2
0
def _output(version_info, lang):
    if lang == "cpp":
        return versioninfooutputter.to_cpp(version_info)
    elif lang == "python":
        return versioninfooutputter.to_python(version_info)
    else:
        raise ValueError("Unknown language")
    def test_output_cpp_with_version_info_with_leading_zero(self):
        expected = """
                // ---------------------------------------------------
                // This file is autogenerated by git-version.
                // DO NOT MODIFY!
                // ---------------------------------------------------

                #pragma once
                #ifndef MESSMER_GITVERSION_VERSION_H
                #define MESSMER_GITVERSION_VERSION_H

                namespace version {
                    constexpr const char *VERSION_STRING = "1.06.dev2+rev230a";
                    constexpr const char *GIT_TAG_NAME = "1.06";
                    constexpr const unsigned int GIT_COMMITS_SINCE_TAG = 2;
                    constexpr const char *GIT_COMMIT_ID = "230a";
                    constexpr bool MODIFIED_SINCE_COMMIT = false;
                    constexpr bool IS_DEV_VERSION = true;
                    constexpr bool IS_STABLE_VERSION = false;

                    constexpr const char *VERSION_COMPONENTS[] = {"1", "06"};
                    constexpr const char *VERSION_TAG = "";
                }

                #endif
            """
        actual = versioninfooutputter.to_cpp(
            versioninfo.VersionInfo("1.06", 2, "230a", True, False))
        self.assertCodeEqual(expected, actual)