tests/test-simplekeyvaluefile.py
changeset 32270 218ca8526ec0
parent 32269 ed2c44741190
child 32279 68c43a416585
equal deleted inserted replaced
32269:ed2c44741190 32270:218ca8526ec0
    70     def testcorruptedfile(self):
    70     def testcorruptedfile(self):
    71         self.vfs.contents['badfile'] = 'ababagalamaga\n'
    71         self.vfs.contents['badfile'] = 'ababagalamaga\n'
    72         self.assertRaises(error.CorruptedState,
    72         self.assertRaises(error.CorruptedState,
    73                           scmutil.simplekeyvaluefile(self.vfs, 'badfile').read)
    73                           scmutil.simplekeyvaluefile(self.vfs, 'badfile').read)
    74 
    74 
       
    75     def testfirstline(self):
       
    76         dw = {'key1': 'value1'}
       
    77         scmutil.simplekeyvaluefile(self.vfs, 'fl').write(dw, firstline='1.0')
       
    78         self.assertEqual(self.vfs.read('fl'), '1.0\nkey1=value1\n')
       
    79         dr = scmutil.simplekeyvaluefile(self.vfs, 'fl')\
       
    80                     .read(firstlinenonkeyval=True)
       
    81         self.assertEqual(dr, {'__firstline': '1.0', 'key1': 'value1'})
       
    82 
    75 if __name__ == "__main__":
    83 if __name__ == "__main__":
    76     silenttestrunner.main(__name__)
    84     silenttestrunner.main(__name__)