404

[ Avaa Bypassed ]




Upload:

Command:

botdev@18.188.195.92: ~ $
#!/usr/bin/env python

# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

""" Unit tests for the easy_xml.py file. """

import gyp.easy_xml as easy_xml
import unittest
try:
  from cStringIO import StringIO
except ImportError:
  from io import StringIO


class TestSequenceFunctions(unittest.TestCase):

  def setUp(self):
    self.stderr = StringIO()

  def test_EasyXml_simple(self):
    self.assertEqual(
      easy_xml.XmlToString(['test']),
      '<?xml version="1.0" encoding="utf-8"?><test/>')

    self.assertEqual(
      easy_xml.XmlToString(['test'], encoding='Windows-1252'),
      '<?xml version="1.0" encoding="Windows-1252"?><test/>')

  def test_EasyXml_simple_with_attributes(self):
    self.assertEqual(
      easy_xml.XmlToString(['test2', {'a': 'value1', 'b': 'value2'}]),
      '<?xml version="1.0" encoding="utf-8"?><test2 a="value1" b="value2"/>')

  def test_EasyXml_escaping(self):
    original = '<test>\'"\r&\nfoo'
    converted = '&lt;test&gt;\'&quot;&#xD;&amp;&#xA;foo'
    converted_apos = converted.replace("'", '&apos;')
    self.assertEqual(
      easy_xml.XmlToString(['test3', {'a': original}, original]),
      '<?xml version="1.0" encoding="utf-8"?><test3 a="%s">%s</test3>' %
      (converted, converted_apos))

  def test_EasyXml_pretty(self):
    self.assertEqual(
      easy_xml.XmlToString(
          ['test3',
            ['GrandParent',
              ['Parent1',
                ['Child']
              ],
              ['Parent2']
            ]
          ],
          pretty=True),
      '<?xml version="1.0" encoding="utf-8"?>\n'
      '<test3>\n'
      '  <GrandParent>\n'
      '    <Parent1>\n'
      '      <Child/>\n'
      '    </Parent1>\n'
      '    <Parent2/>\n'
      '  </GrandParent>\n'
      '</test3>\n')


  def test_EasyXml_complex(self):
    # We want to create:
    target = (
      '<?xml version="1.0" encoding="utf-8"?>'
      '<Project>'
        '<PropertyGroup Label="Globals">'
          '<ProjectGuid>{D2250C20-3A94-4FB9-AF73-11BC5B73884B}</ProjectGuid>'
          '<Keyword>Win32Proj</Keyword>'
          '<RootNamespace>automated_ui_tests</RootNamespace>'
        '</PropertyGroup>'
        '<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props"/>'
        '<PropertyGroup '
            'Condition="\'$(Configuration)|$(Platform)\'=='
                       '\'Debug|Win32\'" Label="Configuration">'
          '<ConfigurationType>Application</ConfigurationType>'
          '<CharacterSet>Unicode</CharacterSet>'
        '</PropertyGroup>'
      '</Project>')

    xml = easy_xml.XmlToString(
        ['Project',
          ['PropertyGroup', {'Label': 'Globals'},
            ['ProjectGuid', '{D2250C20-3A94-4FB9-AF73-11BC5B73884B}'],
            ['Keyword', 'Win32Proj'],
            ['RootNamespace', 'automated_ui_tests']
          ],
          ['Import', {'Project': '$(VCTargetsPath)\\Microsoft.Cpp.props'}],
          ['PropertyGroup',
            {'Condition': "'$(Configuration)|$(Platform)'=='Debug|Win32'",
             'Label': 'Configuration'},
            ['ConfigurationType', 'Application'],
            ['CharacterSet', 'Unicode']
          ]
        ])
    self.assertEqual(xml, target)


if __name__ == '__main__':
  unittest.main()

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
generator Folder 0755
MSVSNew.py File 11.66 KB 0644
MSVSProject.py File 6.24 KB 0644
MSVSSettings.py File 44.17 KB 0644
MSVSSettings_test.py File 64.56 KB 0755
MSVSToolFile.py File 1.76 KB 0644
MSVSUserFile.py File 4.97 KB 0644
MSVSUtil.py File 9.31 KB 0644
MSVSUtil.pyc File 7.55 KB 0644
MSVSVersion.py File 17.02 KB 0644
MSVSVersion.pyc File 14.28 KB 0644
__init__.py File 21.87 KB 0755
__init__.pyc File 16.22 KB 0644
common.py File 20.58 KB 0644
common.pyc File 19.59 KB 0644
common_test.py File 1.92 KB 0755
easy_xml.py File 4.87 KB 0644
easy_xml_test.py File 3.25 KB 0755
flock_tool.py File 1.71 KB 0755
input.py File 113.65 KB 0644
input.pyc File 62.62 KB 0644
input_test.py File 3.11 KB 0755
mac_tool.py File 22.89 KB 0755
msvs_emulation.py File 47.1 KB 0644
msvs_emulation.pyc File 47.84 KB 0644
ninja_syntax.py File 5.41 KB 0644
ninja_syntax.pyc File 6.47 KB 0644
simple_copy.py File 1.3 KB 0644
simple_copy.pyc File 2.23 KB 0644
win_tool.py File 12.72 KB 0755
xcode_emulation.py File 64.85 KB 0644
xcode_emulation.pyc File 61.22 KB 0644
xcode_ninja.py File 10.32 KB 0644
xcode_ninja.pyc File 7.43 KB 0644
xcodeproj_file.py File 117.66 KB 0644
xcodeproj_file.pyc File 93.06 KB 0644
xml_fix.py File 2.12 KB 0644