diff options
author | FallenRiteMonk <fallenritemonk@gmail.com> | 2018-04-05 11:52:34 -0400 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2018-04-05 16:01:07 -0400 |
commit | 25a816dcda7b1db0929501acfe13f2fe5119759b (patch) | |
tree | d3df4377a11dfb643b5976d2048d9bb4ee527903 /deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py | |
parent | b29c36b80746733994257b7380245102bc3c4cd6 (diff) | |
download | android-node-v8-25a816dcda7b1db0929501acfe13f2fe5119759b.tar.gz android-node-v8-25a816dcda7b1db0929501acfe13f2fe5119759b.tar.bz2 android-node-v8-25a816dcda7b1db0929501acfe13f2fe5119759b.zip |
deps: upgrade npm to 5.8.0
PR-URL: https://github.com/nodejs/node/pull/19560
Fixes: https://github.com/nodejs/node/issues/19271
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py')
-rwxr-xr-x | deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py b/deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py new file mode 100755 index 0000000000..df64354982 --- /dev/null +++ b/deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py @@ -0,0 +1,103 @@ +#!/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 +import StringIO + + +class TestSequenceFunctions(unittest.TestCase): + + def setUp(self): + self.stderr = StringIO.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 = '<test>\'"
&
foo' + converted_apos = converted.replace("'", ''') + 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() |