Rev 1063: Add tests for core. in file:///data/jelmer/bzr-svn/cext/

Jelmer Vernooij jelmer at samba.org
Tue Jun 3 04:21:21 BST 2008


At file:///data/jelmer/bzr-svn/cext/

------------------------------------------------------------
revno: 1063
revision-id: jelmer at samba.org-20080603032120-j7izwjrey7i4tin8
parent: jelmer at samba.org-20080603030832-e2bgz7dx2inlrw71
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: cext
timestamp: Tue 2008-06-03 05:21:20 +0200
message:
  Add tests for core.
added:
  tests/test_core.py             test_core.py-20080603032119-q91zmret1lv84ay9-1
modified:
  core.c                         core.pyx-20080313210413-17k59slolpfe5kdq-1
  tests/__init__.py              __init__.py-20060508151940-e9f4d914801a2535
  wc.c                           wc.pyx-20080313142018-10l8l23vha2j9e6b-1
=== modified file 'core.c'
--- a/core.c	2008-06-03 02:11:13 +0000
+++ b/core.c	2008-06-03 03:21:20 +0000
@@ -33,7 +33,7 @@
 	PyObject *ret;
     apr_pool_t *pool;
 	apr_time_t when;
-	if (!PyArg_ParseTuple(args, "l", &when))
+	if (!PyArg_ParseTuple(args, "L", &when))
 		return NULL;
     pool = Pool();
 	if (pool == NULL)
@@ -58,7 +58,7 @@
 		return NULL;
     RUN_SVN_WITH_POOL(pool, svn_time_from_cstring(&when, data, pool));
     apr_pool_destroy(pool);
-    return PyLong_FromLong(when);
+    return PyLong_FromLongLong(when);
 }
 
 typedef struct {

=== modified file 'tests/__init__.py'
--- a/tests/__init__.py	2008-06-03 03:08:32 +0000
+++ b/tests/__init__.py	2008-06-03 03:21:20 +0000
@@ -243,6 +243,7 @@
             'test_changes',
             'test_checkout',
             'test_client',
+            'test_core',
             'test_commit',
             'test_config',
             'test_convert',

=== added file 'tests/test_core.py'
--- a/tests/test_core.py	1970-01-01 00:00:00 +0000
+++ b/tests/test_core.py	2008-06-03 03:21:20 +0000
@@ -0,0 +1,36 @@
+# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer at samba.org>
+ 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""Subversion core library tests."""
+
+from bzrlib.tests import TestCase
+import core
+
+class TestCore(TestCase):
+    def setUp(self):
+        super(TestCore, self).setUp()
+
+    def test_exc(self):
+        self.assertIsInstance(core.SubversionException("foo", 1), Exception)
+
+    def test_get_config(self):
+        self.assertIsInstance(core.get_config(), dict)
+
+    def test_time_from_cstring(self):
+        self.assertEquals(1225704780716938L, core.time_from_cstring("2008-11-03T09:33:00.716938Z"))
+
+    def test_time_to_cstring(self):
+        self.assertEquals("2008-11-03T09:33:00.716938Z", core.time_to_cstring(1225704780716938L))
+

=== modified file 'wc.c'
--- a/wc.c	2008-06-03 00:00:50 +0000
+++ b/wc.c	2008-06-03 03:21:20 +0000
@@ -637,7 +637,7 @@
     apr_pool_t *pool;
     char **pattern;
     apr_hash_t *hash_config;
-	apr_ssize_t idx;
+	apr_ssize_t idx = 0;
 	int i = 0;
 	PyObject *pyk, *pyv, *config;
 	PyObject *ret;




More information about the bazaar-commits mailing list