예제 #1
0
 def test_FindsDocComment(self):
     mkdb.ScanSourceContent("""\
         /**
          * symbol:
          *
          * Description.
          */""".splitlines(keepends=True))
     self.assertEqual({'symbol': 'Description.\n'}, mkdb.SourceSymbolDocs)
예제 #2
0
 def test_FindsSingleDocComment(self):
     blocks = mkdb.ScanSourceContent("""\
         /**
          * symbol:
          *
          * Description.
          */""".splitlines(keepends=True))
     self.assertEqual(1, len(blocks))
예제 #3
0
 def test_HandlesHTMLEntities(self):
     mkdb.ScanSourceContent("""\
         /**
          * symbol:
          *
          * < & >.
          */""".splitlines(keepends=True))
     self.assertEqual({'symbol': '&lt; &amp; &gt;.\n'}, mkdb.SourceSymbolDocs)
예제 #4
0
 def test_FindsDocCommentWithStability(self):
     mkdb.ScanSourceContent("""\
         /**
          * symbol:
          *
          * Stability: stable
          */""".splitlines(keepends=True))
     self.assertIn('symbol', mkdb.StabilityLevel)
     self.assertEqual('Stable', mkdb.StabilityLevel['symbol'])
예제 #5
0
 def test_FindsDocCommentWithSince(self):
     mkdb.ScanSourceContent("""\
         /**
          * symbol:
          *
          * Since: 0.1
          */""".splitlines(keepends=True))
     self.assertIn('symbol', mkdb.Since)
     self.assertEqual('0.1', mkdb.Since['symbol'])
예제 #6
0
 def test_FindsDocCommentWithDeprecated(self):
     mkdb.ScanSourceContent("""\
         /**
          * symbol:
          *
          * Deprecated: use function() instead
          */""".splitlines(keepends=True))
     self.assertIn('symbol', mkdb.Deprecated)
     # TODO: trim whitespace in code
     self.assertEqual(' use function() instead\n', mkdb.Deprecated['symbol'])
예제 #7
0
 def test_FindsDocCommentWithParam(self):
     mkdb.ScanSourceContent("""\
         /**
          * symbol:
          * @par: value
          *
          * Description.
          */""".splitlines(keepends=True))
     self.assertEqual({'symbol': 'Description.\n'}, mkdb.SourceSymbolDocs)
     self.assertIn('symbol', mkdb.SourceSymbolParams)
     self.assertEqual({'par': 'value\n'}, mkdb.SourceSymbolParams['symbol'])
예제 #8
0
 def test_FindsDocCommentWithReturns(self):
     mkdb.ScanSourceContent("""\
         /**
          * symbol:
          *
          * Description.
          *
          * Returns: result
          */""".splitlines(keepends=True))
     # TODO: trim multiple newlines in code
     self.assertEqual({'symbol': 'Description.\n\n'}, mkdb.SourceSymbolDocs)
     self.assertIn('symbol', mkdb.SourceSymbolParams)
     # TODO: trim whitespace in code
     self.assertEqual({'Returns': ' result\n'}, mkdb.SourceSymbolParams['symbol'])
예제 #9
0
 def test_SkipsSingleLineComment(self):
     blocks = mkdb.ScanSourceContent("/** foo */")
     self.assertEqual(0, len(blocks))
예제 #10
0
 def test_EmptyInput(self):
     blocks = mkdb.ScanSourceContent([])
     self.assertEqual(0, len(blocks))
예제 #11
0
 def test_EmptyInput(self):
     mkdb.ScanSourceContent([])
     self.assertEqual({}, mkdb.SourceSymbolDocs)