diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-11-02 16:47:41 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-11-09 16:48:03 +0000 |
commit | e6b58f8cfd34e428f462396d2134fda05154f0e1 (patch) | |
tree | bb1ec9cdaed9310d524bb1d998f71a41619e3cdb /test | |
parent | 3455572a7cb8ed6db6dc20faf8168f8cc81ec7d4 (diff) |
test-specparser: bring up to date with current specparser
Diffstat (limited to 'test')
-rw-r--r-- | test/input/_Test.xml | 7 | ||||
-rwxr-xr-x | test/test-specparser.py | 20 |
2 files changed, 16 insertions, 11 deletions
diff --git a/test/input/_Test.xml b/test/input/_Test.xml index 8c21add9..2a2b193f 100644 --- a/test/input/_Test.xml +++ b/test/input/_Test.xml @@ -19,6 +19,11 @@ USA.</p> </tp:license> <interface name="org.freedesktop.Telepathy.SpecAutoGenTest"> + <tp:struct name="UV" array-name="UV_List"> + <tp:member name="Uint" type="u"/> + <tp:member name="Variant" type="v"/> + </tp:struct> + <method name="DoStuff" tp:name-for-bindings="Do_Stuff"> <arg direction="in" name="badger" type="b"> <tp:docstring>A badger, which MAY be breezy.</tp:docstring> @@ -29,7 +34,7 @@ USA.</p> <arg direction="in" name="snake" type="s"> <tp:docstring>A snake, it's a snake.</tp:docstring> </arg> - <arg direction="out" type="a(uv)"> + <arg direction="out" name="misc" type="a(uv)" tp:type="UV[]"> <tp:docstring>Array of structs containing whatever seems appropriate.</tp:docstring> </arg> <tp:possible-errors> diff --git a/test/test-specparser.py b/test/test-specparser.py index d530a68a..aa52d744 100755 --- a/test/test-specparser.py +++ b/test/test-specparser.py @@ -12,7 +12,7 @@ spec_path = os.path.join (test_dir, 'input/all.xml') def test_specparser (): """ ->>> spec = specparser.parse (spec_path) +>>> spec = specparser.parse (spec_path, 'org.freedesktop.Telepathy.SpecAutoGenTest') >>> spec Spec(telepathy-spec tools test case) @@ -25,7 +25,7 @@ Spec(telepathy-spec tools test case) >>> spec.generic_types [] >>> spec.types -{u'Adjective': Enum(org.freedesktop.Telepathy.SpecAutoGenTest.Adjective), u'Test_Flags': Flags(org.freedesktop.Telepathy.SpecAutoGenTest.Test_Flags)} +{u'Adjective': Enum(Adjective), u'Test_Flags': Flags(Test_Flags), u'UV': Struct(UV)} >>> i = spec.interfaces[0] >>> i @@ -44,7 +44,7 @@ AttributeError: 'Method' object has no attribute 'args' >>> i.methods[0].in_args [Arg(org.freedesktop.Telepathy.SpecAutoGenTest.DoStuff.badger:b), Arg(org.freedesktop.Telepathy.SpecAutoGenTest.DoStuff.mushroom:a{sv}), Arg(org.freedesktop.Telepathy.SpecAutoGenTest.DoStuff.snake:s)] >>> i.methods[0].out_args -[Arg(org.freedesktop.Telepathy.SpecAutoGenTest.DoStuff:a(uv))] +[Arg(org.freedesktop.Telepathy.SpecAutoGenTest.DoStuff.misc:a(uv))] >>> i.methods[0].possible_errors [PossibleError(org.freedesktop.Telepathy.SpecAutoGenTest.MiscError), PossibleError(org.freedesktop.Telepathy.SpecAutoGenTest.OtherError)] @@ -68,25 +68,25 @@ u'b' None >>> i.types -[Enum(org.freedesktop.Telepathy.SpecAutoGenTest.Adjective), Flags(org.freedesktop.Telepathy.SpecAutoGenTest.Test_Flags)] +[Enum(Adjective), Flags(Test_Flags), Struct(UV)] >>> i.types[0].values -[EnumValue(org.freedesktop.Telepathy.SpecAutoGenTest.Adjective.Leveraging), EnumValue(org.freedesktop.Telepathy.SpecAutoGenTest.Adjective.Synergistic)] +[EnumValue(Adjective.Leveraging), EnumValue(Adjective.Synergistic)] >>> map (lambda v: (v.short_name, v.value), i.types[0].values) [(u'Leveraging', u'0'), (u'Synergistic', u'1')] >>> i.types[1].values -[EnumValue(org.freedesktop.Telepathy.SpecAutoGenTest.Test_Flags.LowBit), EnumValue(org.freedesktop.Telepathy.SpecAutoGenTest.Test_Flags.HighBit)] +[EnumValue(Test_Flags.LowBit), EnumValue(Test_Flags.HighBit)] >>> map (lambda v: (v.short_name, v.value), i.types[1].values) [(u'LowBit', u'1'), (u'HighBit', u'128')] ->>> spec.everything -{u'org.freedesktop.Telepathy.SpecAutoGenTest.DoStuff': Method(org.freedesktop.Telepathy.SpecAutoGenTest.DoStuff), u'org.freedesktop.Telepathy.SpecAutoGenTest': Interface(org.freedesktop.Telepathy.SpecAutoGenTest), u'org.freedesktop.Telepathy.SpecAutoGenTest.Introspective': Property(org.freedesktop.Telepathy.SpecAutoGenTest.Introspective:b), u'org.freedesktop.Telepathy.SpecAutoGenTest.StuffHappened': Signal(org.freedesktop.Telepathy.SpecAutoGenTest.StuffHappened)} +>>> sorted(spec.everything.items()) +[(u'org.freedesktop.Telepathy.SpecAutoGenTest', Interface(org.freedesktop.Telepathy.SpecAutoGenTest)), (u'org.freedesktop.Telepathy.SpecAutoGenTest.DoStuff', Method(org.freedesktop.Telepathy.SpecAutoGenTest.DoStuff)), (u'org.freedesktop.Telepathy.SpecAutoGenTest.Introspective', Property(org.freedesktop.Telepathy.SpecAutoGenTest.Introspective:b)), (u'org.freedesktop.Telepathy.SpecAutoGenTest.StuffHappened', Signal(org.freedesktop.Telepathy.SpecAutoGenTest.StuffHappened)), (u'org.freedesktop.Telepathy.SpecAutoGenTest.wobbly', AwkwardTelepathyProperty(org.freedesktop.Telepathy.SpecAutoGenTest.wobbly:b))] >>> map (lambda o: i.added, spec.everything.values ()) -[None, None, None, None] +[None, None, None, None, None] >>> map (lambda o: i.deprecated, spec.everything.values ()) -[None, None, None, None] +[None, None, None, None, None] """ if __name__ == '__main__': |