コード例 #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)