~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-20 05:08:48 UTC
  • mfrom: (4171.1.1 ianc-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090320050848-c1wdgzf5kkfdt1ys
Content filters (Ian Clatworthy)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1475
1475
        self.assertTrue(-eighteen_hours < offset < eighteen_hours)
1476
1476
 
1477
1477
 
 
1478
class TestSizeShaFile(TestCaseInTempDir):
 
1479
 
 
1480
    def test_sha_empty(self):
 
1481
        self.build_tree_contents([('foo', '')])
 
1482
        expected_sha = osutils.sha_string('')
 
1483
        f = open('foo')
 
1484
        self.addCleanup(f.close)
 
1485
        size, sha = osutils.size_sha_file(f)
 
1486
        self.assertEqual(0, size)
 
1487
        self.assertEqual(expected_sha, sha)
 
1488
 
 
1489
    def test_sha_mixed_endings(self):
 
1490
        text = 'test\r\nwith\nall\rpossible line endings\r\n'
 
1491
        self.build_tree_contents([('foo', text)])
 
1492
        expected_sha = osutils.sha_string(text)
 
1493
        f = open('foo')
 
1494
        self.addCleanup(f.close)
 
1495
        size, sha = osutils.size_sha_file(f)
 
1496
        self.assertEqual(38, size)
 
1497
        self.assertEqual(expected_sha, sha)
 
1498
 
 
1499
 
1478
1500
class TestShaFileByName(TestCaseInTempDir):
1479
1501
 
1480
1502
    def test_sha_empty(self):