~ubuntu-branches/ubuntu/oneiric/enigmail/oneiric-updates

« back to all changes in this revision

Viewing changes to config/tests/unit-LineEndings.py

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2010-04-10 01:42:24 UTC
  • Revision ID: james.westby@ubuntu.com-20100410014224-fbq9ui5x3b0h2t36
Tags: 2:1.0.1-0ubuntu1
* First releaase of enigmail 1.0.1 for tbird/icedove 3
  (LP: #527138)
* redo packaging from scratch 
  + add debian/make-orig target that uses xulrunner provided
    buildsystem + enigmail tarball to produce a proper orig.tar.gz
  + use debhelper 7 with mozilla-devscripts
  + use debian source format 3.0 (quilt)
  + patch enigmail to use frozen API only
    - add debian/patches/frozen_api.diff
  + patch build system to not link against -lxul - which isnt
    available for sdks produced by all-static apps like tbird
    - add debian/patches/build_system_dont_link_libxul.diff
  + add minimal build-depends to control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import unittest
 
2
 
 
3
from StringIO import StringIO
 
4
import os
 
5
import sys
 
6
import os.path
 
7
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 
8
 
 
9
from Preprocessor import Preprocessor
 
10
 
 
11
class TestLineEndings(unittest.TestCase):
 
12
  """
 
13
  Unit tests for the Context class
 
14
  """
 
15
 
 
16
  def setUp(self):
 
17
    self.pp = Preprocessor()
 
18
    self.pp.out = StringIO()
 
19
    self.tempnam = os.tempnam('.')
 
20
 
 
21
  def tearDown(self):
 
22
    os.remove(self.tempnam)
 
23
 
 
24
  def createFile(self, lineendings):
 
25
    f = open(self.tempnam, 'wb')
 
26
    for line, ending in zip(['a', '#literal b', 'c'], lineendings):
 
27
      f.write(line+ending)
 
28
    f.close()
 
29
 
 
30
  def testMac(self):
 
31
    self.createFile(['\x0D']*3)
 
32
    self.pp.do_include(self.tempnam)
 
33
    self.assertEquals(self.pp.out.getvalue(), 'a\nb\nc\n')
 
34
 
 
35
  def testUnix(self):
 
36
    self.createFile(['\x0A']*3)
 
37
    self.pp.do_include(self.tempnam)
 
38
    self.assertEquals(self.pp.out.getvalue(), 'a\nb\nc\n')
 
39
 
 
40
  def testWindows(self):
 
41
    self.createFile(['\x0D\x0A']*3)
 
42
    self.pp.do_include(self.tempnam)
 
43
    self.assertEquals(self.pp.out.getvalue(), 'a\nb\nc\n')
 
44
 
 
45
if __name__ == '__main__':
 
46
  unittest.main()