2021-04-07 14:29:31 +00:00
|
|
|
-- Copyright (C) 2019-2021 Igara Studio S.A.
|
2019-04-21 03:05:21 +00:00
|
|
|
-- Copyright (C) 2018 David Capello
|
|
|
|
--
|
|
|
|
-- This file is released under the terms of the MIT license.
|
|
|
|
-- Read LICENSE.txt for more information.
|
|
|
|
|
|
|
|
assert(string.sub(tostring(app.version), 1, 1) == "1")
|
|
|
|
assert(string.sub(tostring(app.version), 2, 2) == ".")
|
|
|
|
assert(app.version.major == 1)
|
2020-03-26 02:17:48 +00:00
|
|
|
|
2021-04-07 14:29:31 +00:00
|
|
|
-- We cannot test the specific app.version from the "main" branch
|
2020-03-26 02:17:48 +00:00
|
|
|
-- because it's "1.x-dev" (which is converted to "1.0-dev" as Version object)
|
|
|
|
--assert(app.version > Version("1.2.10-beta4"))
|
2019-04-21 03:05:21 +00:00
|
|
|
|
|
|
|
assert(Version("1") == Version("1"))
|
|
|
|
assert(Version("1.1") > Version("1"))
|
|
|
|
assert(Version("0.1") < Version("0.2"))
|
|
|
|
assert(Version("1.0.1") > Version("1"))
|
|
|
|
assert(Version("1.0.1") < Version("1.1"))
|
|
|
|
assert(Version("1.0.1") == Version("1.0.1"))
|
|
|
|
assert(Version("1.0.1") ~= Version("1.0.2"))
|
|
|
|
assert(Version("1.0.1") > Version("1.0.1-beta"))
|
|
|
|
assert(Version("1.0.1") > Version("1.0.1-dev"))
|
|
|
|
assert(Version("1.0.1-beta") > Version("1.0.1-alpha"))
|
|
|
|
assert(Version("1.0.1-beta50") < Version("1.0.1-beta100"))
|
2019-04-21 03:10:56 +00:00
|
|
|
assert(Version("1.0.1-beta50") <= Version("1.0.1-beta100"))
|
|
|
|
assert(Version("1.0.1-beta100") <= Version("1.0.1-beta100"))
|
2019-04-21 03:05:21 +00:00
|
|
|
|
|
|
|
local v = Version()
|
|
|
|
assert(v.major == 0)
|
|
|
|
assert(v.minor == 0)
|
|
|
|
assert(v.patch == 0)
|
2019-04-22 12:04:27 +00:00
|
|
|
assert(v.prereleaseLabel == "")
|
|
|
|
assert(v.prereleaseNumber == 0)
|
2019-04-21 03:05:21 +00:00
|
|
|
|
|
|
|
v = Version("1.2.10-beta4")
|
|
|
|
assert(v.major == 1)
|
|
|
|
assert(v.minor == 2)
|
|
|
|
assert(v.patch == 10)
|
2019-04-22 12:04:27 +00:00
|
|
|
assert(v.prereleaseLabel == "beta")
|
|
|
|
assert(v.prereleaseNumber == 4)
|