buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_comments.py
author wbernard
Sun, 10 Oct 2010 15:22:15 +0300
changeset 645 b8d81fa19e7d
parent 588 c7c26511138f
permissions -rw-r--r--
helium_12.0.0-63b64366f9cf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     1
#============================================================================ 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     2
#Name        : test_comments.py 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     3
#Part of     : Helium 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     4
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     5
#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     6
#All rights reserved.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     7
#This component and the accompanying materials are made available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     8
#under the terms of the License "Eclipse Public License v1.0"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     9
#which accompanies this distribution, and is available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    10
#at the URL "http://www.eclipse.org/legal/epl-v10.html".
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    11
#
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    12
#Initial Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    13
#Nokia Corporation - initial contribution.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    14
#
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    15
#Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    16
#
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    17
#Description:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    18
#===============================================================================
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    19
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    20
""" Test cases for Comments.py. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    21
import unittest
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    22
import comments
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    23
import amara
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    24
import os
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    25
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    26
class CommentParserTest(unittest.TestCase):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    27
    """ Test cases for Comments.py. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    28
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    29
    def setUp(self):
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    30
        """ Initialize the sample files into two Comment Parsers."""
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    31
        self.parser1 = comments.CommentParser( [os.environ['TEST_DATA'] + '/data/comments_test.txt'], 'branchInfo' )
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    32
        self.parser2 = comments.CommentParser( [os.environ['TEST_DATA'] + '/data/comments_test.cpp', os.environ['TEST_DATA'] + '/data/comments_test.bat',
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    33
                                                os.environ['TEST_DATA'] + '/data/comments_test.h', os.environ['TEST_DATA'] + '/data/comments_test.hrh',
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    34
                                                os.environ['TEST_DATA'] + '/data/comments_test.iby', os.environ['TEST_DATA'] + '/data/comments_test.inf',
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    35
                                                os.environ['TEST_DATA'] + '/data/comments_test.mk', os.environ['TEST_DATA'] + '/data/comments_test.mmp',
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    36
                                                os.environ['TEST_DATA'] + '/data/comments_test.pl', os.environ['TEST_DATA'] + '/data/comments_test.xml',
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    37
                                                os.environ['TEST_DATA'] + '/data/comments_test.py', os.environ['TEST_DATA'] + '/data/comments_test.java',
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    38
                                                os.environ['TEST_DATA'] + '/data/comments_test1.cmd', os.environ['TEST_DATA'] + '/data/comments_test2.cmd'], 'branchInfo' )
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    39
     #   self.parser3 = comments.CommentParser( [os.environ['TEST_DATA'] + '/data/comments_test2.cmd'], 'branchInfo' )
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    40
     
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    41
        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    42
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    43
    def test_scan(self):
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    44
        """ Unit test for method scan() in comments.py. It also tested scan_content by using scan()"""
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    45
        #doc1 for only one txt file. 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    46
        doc1 = amara.parse(self.parser1.scan().xml())
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    47
        #doc2 for all other 14 types of files. It also included two types of cmd files.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    48
        doc2 = amara.parse(self.parser2.scan().xml())
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    49
        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    50
        # doc1's test verifies all the information the xml comment provides.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    51
        self.assertEquals(doc1.commentLog.branchInfo.originator, "sanummel")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    52
        self.assertEquals(doc1.commentLog.branchInfo.category, "")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    53
        self.assertEquals(doc1.commentLog.branchInfo.since, "07-03-22")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    54
        self.assertEquals(doc1.commentLog.branchInfo.file, os.environ['TEST_DATA'] + '/data/comments_test.txt')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    55
        self.assertEquals(doc1.commentLog.branchInfo.error, "kkk")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    56
        self.assertEquals(str(doc1.commentLog.branchInfo).strip(),"Add rofsfiles for usage in paged images")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    57
        # s = (str(doc1.commentLog.xml()))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    58
        # print s
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    59
        # doc2's test only verifies the main comment content.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    60
        self.assertEquals(str(doc2.commentLog.branchInfo[0]).strip(), "We need TwistOpen and TwistClose to cause display to change between\n landscape and portrait, but SysAp is consuming the key events.  Try\n treating them as Flip events are handled already by SysAp.")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    61
        self.assertEquals(str(doc2.commentLog.branchInfo[1]).strip(), "Testing if it's good~~~")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    62
        self.assertEquals(str(doc2.commentLog.branchInfo[2]).strip(), "We need TwistOpen and TwistClose to cause display to change between\n landscape and portrait, but SysAp is consuming the key events.  Try\n treating them as Flip events are handled already by SysAp.")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    63
        self.assertEquals(str(doc2.commentLog.branchInfo[3]).strip(), "puikko ME SCD DeSW: wk21 Flag fix")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    64
        self.assertEquals(str(doc2.commentLog.branchInfo[4]).strip(), "Since Catalogs is not compiling at this point, and we are not building it, don't try to\n pull it into the rom.  Also, tfxserver is crashing, so don't build or pull it in either.")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    65
        self.assertEquals(str(doc2.commentLog.branchInfo[5]).strip(), "Fix target export, which cause issue when cleanexport.")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    66
        self.assertEquals(str(doc2.commentLog.branchInfo[6]).strip(), "Move command to makmake as EBS does not call abld build")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    67
        self.assertEquals(str(doc2.commentLog.branchInfo[7]).strip(), "Activate PCFW for Screensaver")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    68
        self.assertEquals(str(doc2.commentLog.branchInfo[8]).strip(), "Support SPP mechanism for flags support.")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    69
        self.assertEquals(str(doc2.commentLog.branchInfo[9]).strip(), "Enabling all the HWRM light zones target for product")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    70
        self.assertEquals(str(doc2.commentLog.branchInfo[10]).strip(), "Again, it is just a test")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    71
        self.assertEquals(str(doc2.commentLog.branchInfo[11]).strip(), "Test info, so whatever~")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    72
        self.assertEquals(str(doc2.commentLog.branchInfo[12]).strip(), "k")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    73
        self.assertEquals(str(doc2.commentLog.branchInfo[13]).strip(), "")
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    74
          
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    75
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    76