[asterisk-commits] mnicholson: testsuite/asterisk/trunk r1768 - in /asterisk/trunk/asttest: lib/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 21 11:28:39 CDT 2011


Author: mnicholson
Date: Thu Jul 21 11:28:35 2011
New Revision: 1768

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1768
Log:
support comparing and parsing asterisk 10 version numbers and beyond

Modified:
    asterisk/trunk/asttest/lib/lua/astlib.lua
    asterisk/trunk/asttest/self-tests/asterisk_version/test.lua

Modified: asterisk/trunk/asttest/lib/lua/astlib.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/asttest/lib/lua/astlib.lua?view=diff&rev=1768&r1=1767&r2=1768
==============================================================================
--- asterisk/trunk/asttest/lib/lua/astlib.lua (original)
+++ asterisk/trunk/asttest/lib/lua/astlib.lua Thu Jul 21 11:28:35 2011
@@ -398,19 +398,28 @@
 	self.concept, self.major, self.minor = self.branch:match("branch%-([^.]+).(%d+).(%d+)")
 	if not self.concept then
 		self.minor = "999" -- assume the SVN branch is newer than all released versions
+		self.patch = self.revision:match("(%d+)M?")
 		self.concept, self.major = self.branch:match("branch%-([^.]+).(%d+)")
+	end
+	if not self.concept then
+		self.concept = self.branch:match("branch%-(%d%d+)")
+		self.major = self.revision:match("(%d+)M?") or "999"
+		self.minor = nil
+		self.patch = nil
 	end
 	if not self.concept then
 		if self.branch == "trunk" then
 			self.concept = "999"
 			self.major = "0"
 			self.minor = "0"
+			self.patch = self.revision:match("(%d+)M?")
 		else
 			-- branch names that don't match are greater
 			-- than everything except trunk
 			self.concept = "998"
 			self.major = "0"
 			self.minor = "0"
+			self.patch = self.revision:match("(%d+)M?")
 		end
 	end
 
@@ -442,7 +451,10 @@
 		self.concept, self.major, self.minor = self.version:match("([^.]+).(%d+).(%d+)")
 	end
 	if not self.concept then
-		self.concept, self.major, self.minor = self.version:match("([^.]+).(%d+)")
+		self.concept, self.major = self.version:match("([^.]+).(%d+)")
+	end
+	if not self.concept then
+		self.concept = self.version:match("(%d%d+)")
 	end
 
 	if not self.concept then
@@ -450,7 +462,11 @@
 	end
 
 	-- generate synthetic svn information
-	self.branch = "branch-" .. self.concept .. "." .. self.major
+	if ((tonumber(self.concept) or 0) >= 10) then
+		self.branch = "branch-" .. self.concept
+	else
+		self.branch = "branch-" .. self.concept .. "." .. self.major
+	end
 
 	-- special handling for 1.6 branches
 	if self.concept == "1" and self.major == "6"  and self.minor ~= nil then
@@ -468,7 +484,7 @@
 		self.order.patch = tonumber(self.patch or 0)
 	else
 		self.order.concept = tonumber(self.concept)
-		self.order.major = tonumber(self.major)
+		self.order.major = tonumber(self.major or 0)
 		self.order.minor = tonumber(self.minor or 0)
 		self.order.patch = tonumber(self.patch or 0)
 	end

Modified: asterisk/trunk/asttest/self-tests/asterisk_version/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/asttest/self-tests/asterisk_version/test.lua?view=diff&rev=1768&r1=1767&r2=1768
==============================================================================
--- asterisk/trunk/asttest/self-tests/asterisk_version/test.lua (original)
+++ asterisk/trunk/asttest/self-tests/asterisk_version/test.lua Thu Jul 21 11:28:35 2011
@@ -100,21 +100,29 @@
 normal_version("1.4", "1", "4")
 normal_version("C.3", "C", "3")
 normal_version("C.3.5", "C", "3", "5")
+normal_version("10", "10")
+normal_version("10.0", "10", "0")
+normal_version("10.0.1", "10", "0", "1")
 synthetic_svn_version("1.4.30", "branch-1.4", "00000")
 synthetic_svn_version("1.4.30.1", "branch-1.4", "00000")
 synthetic_svn_version("1.4", "branch-1.4", "00000")
 synthetic_svn_version("C.3", "branch-C.3", "00000")
 synthetic_svn_version("C.3.5", "branch-C.3", "00000")
 synthetic_svn_version("C.3", "branch-C.3", "00000")
+synthetic_svn_version("10", "branch-10", "00000")
+synthetic_svn_version("10.0", "branch-10", "00000")
+synthetic_svn_version("10.0.1", "branch-10", "00000")
 
 svn_version("SVN-trunk-r252849", "trunk", "252849")
 svn_version("SVN-branch-1.6.2-r245581M", "branch-1.6.2", "245581M")
 svn_version("SVN-branch-C.3-r1234", "branch-C.3", "1234")
+svn_version("SVN-branch-10-r1234", "branch-10", "1234")
 svn_version("SVN-branch-C.3-duckpond-r1234", "branch-C.3-duckpond", "1234")
 svn_version("SVN-russell-cdr-q-r249059M-/trunk", "russell-cdr-q", "249059M", "/trunk")
 svn_version("SVN-russell-rest-r1234", "russell-rest", "1234")
 synthetic_version("SVN-trunk-r252849", "999", "0", "0", "252849")
 synthetic_version("SVN-branch-1.6.2-r245581M", "1", "6", "2", "245581")
+synthetic_version("SVN-branch-10-r245581M", "10", "245581")
 synthetic_version("SVN-russell-cdr-q-r249059M-/trunk", "998", "0", "0", "249059")
 synthetic_version("SVN-russell-rest-r1234", "998", "0", "0", "1234")
 synthetic_version("SVN-branch-1.4-r1234", "1", "4", "999", "1234")
@@ -129,6 +137,7 @@
 major_version("1.6.2", "1.6.2.0")
 major_version("C.3", "C.3")
 major_version("C.3", "C.3.5")
+major_version("10", "10.0")
 
 not_major_version("1.4", "1.6.2")
 not_major_version("1.4", "1.8")
@@ -149,6 +158,8 @@
 compare_false("1.6.2 >= 1.6.3")
 
 -- these comparisons should evaluate to true
+compare("10 > 1.6.2")
+compare("10.0 > 1.6.2")
 compare("1.6.2 <= 1.6.2")
 compare("1.6.2 <= 1.6.3")
 compare("1.4 < 1.6.2")




More information about the asterisk-commits mailing list