def testSpacesInFilenames(self): self.tempfile = tempfile.mktemp("_sdktest") with open(self.tempfile, 'w') as out: out.write('foo.o: foo\\ bar.h\n') fix_deps.FixupDepFile(self.tempfile) with open(self.tempfile) as infile: contents = infile.read() lines = contents.splitlines() self.assertEqual(len(lines), 3) self.assertEqual(lines[2], 'foo\\ bar.h:')
def testColonInFilename(self): self.tempfile = tempfile.mktemp("_sdktest") with open(self.tempfile, 'w') as out: out.write('foo.o: c:foo.c\\\n c:bar.h\n') fix_deps.FixupDepFile(self.tempfile) with open(self.tempfile) as infile: contents = infile.read() lines = contents.splitlines() self.assertEqual(len(lines), 5) self.assertEqual(lines[3], 'c:foo.c:') self.assertEqual(lines[4], 'c:bar.h:')
def testAddsDeps(self): self.tempfile = tempfile.mktemp("_sdktest") with open(self.tempfile, 'w') as out: out.write('foo.o: foo.c foo.h bar.h\n') fix_deps.FixupDepFile(self.tempfile) with open(self.tempfile) as infile: contents = infile.read() lines = contents.splitlines() self.assertEqual(len(lines), 5) self.assertTrue('foo.c:' in lines) self.assertTrue('foo.h:' in lines) self.assertTrue('bar.h:' in lines)
def testDoubleInvoke(self): self.tempfile = tempfile.mktemp("_sdktest") with open(self.tempfile, 'w') as out: out.write('foo.o: foo\\ bar.h\n') fix_deps.FixupDepFile(self.tempfile) self.assertRaises(fix_deps.Error, fix_deps.FixupDepFile, self.tempfile)