File indexing completed on 2024-05-19 08:36:30

0001 # -*- coding: utf-8 -*-
0002 #     Copyright 2009 Simon Edwards <simon@simonzone.com>
0003 #
0004 # This program is free software; you can redistribute it and/or modify
0005 # it under the terms of the GNU General Public License as published by
0006 # the Free Software Foundation; either version 2 of the License, or
0007 # (at your option) any later version.
0008 #
0009 # This program is distributed in the hope that it will be useful,
0010 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0011 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012 # GNU General Public License for more details.
0013 #
0014 # You should have received a copy of the GNU General Public License
0015 # along with this program; if not, write to the
0016 # Free Software Foundation, Inc.,
0017 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0018 
0019 import unittest
0020 import pplexer
0021 
0022 class TestPpParser(unittest.TestCase):
0023 #    def setUp(self):
0024 #        self.parser = ppparser.PpParser()
0025 #        self.syms = cppsymboldata.SymbolData()
0026 
0027     def testFixDoc(self):
0028         print(pplexer.fixDoc("""
0029 enum TimeFormatOption {
0030     TimeDefault        = 0x0,   ///< Default formatting using seconds and the format
0031                                 ///< as specified by the locale.
0032     TimeDuration       = 0x6   ///< Read/format time string as duration. This will strip
0033 };
0034 """.split('\n')))#,[],[]))
0035 
0036     def testDefinesFunction(self):
0037         print(pplexer.preprocess("""
0038             /**
0039              * http://freedesktop.org/standards/xesam/1.0/core#definesClass 
0040              * 
0041              * Source code defines class 
0042              */
0043             SOPRANO_EXPORT QUrl definesClass();
0044 
0045 """))
0046 
0047     def testDefinesFunction2(self):
0048         print(pplexer.preprocess("""/*
0049  * foo
0050  */
0051 
0052 #ifndef _SOPRANO_SERVER_DBUS_CLIENT_H_
0053 #define _SOPRANO_SERVER_DBUS_CLIENT_H_
0054 
0055 #include <QtCore/QObject>
0056 
0057 #include "backend.h"
0058 #include "error.h"
0059 #include "soprano_export.h"
0060 
0061 namespace Soprano {
0062 
0063     class Model;
0064 
0065 };
0066 #endif 
0067 """))
0068 
0069     def testComments(self):
0070         print(pplexer.preprocess("""
0071 class Foo {
0072 public:
0073     /**
0074      * bar docs.
0075      */
0076     void bar();
0077 };
0078 
0079 """))
0080 
0081 
0082 if __name__ == '__main__':
0083     unittest.main()