예제 #1
0
 def testNonIncludesLinesAfterIncludesTerminates(self):
     begin, end = add_header.FindIncludes([
         '#include "moo.h"', '#ifndef COW_MESSAGES_H_',
         '#define COW_MESSAGE_H_'
     ])
     self.assertEqual(begin, 0)
     self.assertEqual(end, 1)
예제 #2
0
 def testCommentsBetweenIncludes(self):
     begin, end = add_header.FindIncludes([
         '#include <utility>', '// TODO: Add goat support.',
         '#include "moo.h"'
     ])
     self.assertEqual(begin, 0)
     self.assertEqual(end, 3)
예제 #3
0
 def testCommentsNotIncluded(self):
     begin, end = add_header.FindIncludes([
         '// Cow module.', '#include <utility>',
         '// For cow speech synthesis.', '#include "moo.h"',
         '// TODO: Add Linux audio support.'
     ])
     self.assertEqual(begin, 1)
     self.assertEqual(end, 4)
예제 #4
0
 def testNonIncludesLinesBeforeIncludesIgnored(self):
     begin, end = add_header.FindIncludes(
         ['#ifndef COW_H_', '#define COW_H_', '#include "moo.h"'])
     self.assertEqual(begin, 2)
     self.assertEqual(end, 3)
예제 #5
0
 def testEmptyLinesNotIncluded(self):
     begin, end = add_header.FindIncludes(
         ['', '#include <utility>', '', '#include "moo.h"', ''])
     self.assertEqual(begin, 1)
     self.assertEqual(end, 4)
예제 #6
0
 def testNewlinesBetweenIncludes(self):
     begin, end = add_header.FindIncludes(
         ['#include <utility>', '', '#include "moo.h"'])
     self.assertEqual(begin, 0)
     self.assertEqual(end, 3)
예제 #7
0
 def testIncludeWithInlineComment(self):
     begin, end = add_header.FindIncludes(
         ['#include "moo.h"  // TODO: Add more sounds.'])
     self.assertEqual(begin, 0)
     self.assertEqual(end, 1)
예제 #8
0
 def testOneInclude(self):
     begin, end = add_header.FindIncludes(['#include <algorithm>'])
     self.assertEqual(begin, 0)
     self.assertEqual(end, 1)
예제 #9
0
 def testNoIncludes(self):
     begin, end = add_header.FindIncludes(['a'])
     self.assertEqual(begin, -1)
     self.assertEqual(end, -1)
예제 #10
0
 def testEmpty(self):
     begin, end = add_header.FindIncludes([])
     self.assertEqual(begin, -1)
     self.assertEqual(end, -1)