From 7eb9ede0652458db23d25cbc5b5b8718012fc447 Mon Sep 17 00:00:00 2001
From: David Raila <raila@illinois.edu>
Date: Mon, 18 Aug 2008 22:55:31 +0000
Subject: [PATCH] More prep for 2.0.1: * Fix version number test so that it
 accepts "2.0.1rc1". * Add missing type_checkers.py to Makefile.am.

---
 Makefile.am                                  | 1 +
 src/google/protobuf/stubs/common_unittest.cc | 9 +++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4e2f651..cd90b6c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -84,6 +84,7 @@ EXTRA_DIST =                                                                 \
   python/google/protobuf/internal/service_reflection_test.py                 \
   python/google/protobuf/internal/test_util.py                               \
   python/google/protobuf/internal/text_format_test.py                        \
+  python/google/protobuf/internal/type_checkers.py                           \
   python/google/protobuf/internal/wire_format.py                             \
   python/google/protobuf/internal/wire_format_test.py                        \
   python/google/protobuf/internal/__init__.py                                \
diff --git a/src/google/protobuf/stubs/common_unittest.cc b/src/google/protobuf/stubs/common_unittest.cc
index c339c5f..bccc1e0 100644
--- a/src/google/protobuf/stubs/common_unittest.cc
+++ b/src/google/protobuf/stubs/common_unittest.cc
@@ -37,11 +37,12 @@ namespace {
 TEST(VersionTest, VersionMatchesConfig) {
   // Verify that the version string specified in config.h matches the one
   // in common.h.  The config.h version is a string which may have a suffix
-  // like "beta", so we remove that.
+  // like "beta" or "rc1", so we remove that.
   string version = PACKAGE_VERSION;
-  int pos = version.size();
-  while (pos > 0 && !ascii_isdigit(version[pos-1])) {
-    --pos;
+  int pos = 0;
+  while (pos < version.size() &&
+         (ascii_isdigit(version[pos]) || version[pos] == '.')) {
+    ++pos;
   }
   version.erase(pos);
 
-- 
GitLab