Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  test_union_callback_dict.py   Sprache: Python

 
import WebIDL


def WebIDLTest(parser, harness):
    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
            dictionary TestDict {
            DOMString member;
            };
            [LegacyTreatNonObjectAsNull] callback TestCallback = undefined ();
            typedef (TestCallback or TestDict) TestUnionCallbackDict;
            """
        )
        results = parser.finish()
    except WebIDL.WebIDLError:
        threw = True
    harness.ok(
        threw,
        "Should not allow Dict/Callback union where callback is [LegacyTreatNonObjectAsNull]",
    )

    parser = parser.reset()

    threw = False
    try:
        parser.parse(
            """
            dictionary TestDict {
            DOMString member;
            };
            [LegacyTreatNonObjectAsNull] callback TestCallback = undefined ();
            typedef (TestDict or TestCallback) TestUnionCallbackDict;
            """
        )
        results = parser.finish()
    except WebIDL.WebIDLError:
        threw = True
    harness.ok(
        threw,
        "Should not allow Dict/Callback union where callback is [LegacyTreatNonObjectAsNull]",
    )

    parser = parser.reset()

    parser.parse(
        """
        dictionary TestDict {
          DOMString member;
        };
        callback TestCallback = undefined ();
        typedef (TestCallback or TestDict) TestUnionCallbackDict;
        """
    )
    results = parser.finish()

    harness.ok(True"TestUnionCallbackDict interface parsed without error")
    harness.check(len(results), 3, "Document should have 3 types")

    myDict = results[0]
    harness.ok(isinstance(myDict, WebIDL.IDLDictionary), "Expect an IDLDictionary")

    myCallback = results[1]
    harness.ok(isinstance(myCallback, WebIDL.IDLCallback), "Expect an IDLCallback")

    myUnion = results[2]
    harness.ok(isinstance(myUnion, WebIDL.IDLTypedef), "Expect a IDLTypedef")
    harness.ok(
        isinstance(myUnion.innerType, WebIDL.IDLUnionType), "Expect a IDLUnionType"
    )
    harness.ok(
        isinstance(myUnion.innerType.memberTypes[0], WebIDL.IDLCallbackType),
        "Expect a IDLCallbackType",
    )
    harness.ok(
        isinstance(myUnion.innerType.memberTypes[1], WebIDL.IDLWrapperType),
        "Expect a IDLDictionary",
    )
    harness.ok(
        (myUnion.innerType.memberTypes[0].callback == myCallback),
        "Expect left Union member to be MyCallback",
    )
    harness.ok(
        (myUnion.innerType.memberTypes[1].inner == myDict),
        "Expect right Union member to be MyDict",
    )

    parser = parser.reset()

    parser.parse(
        """
        dictionary TestDict {
          DOMString member;
        };
        callback TestCallback = undefined ();
        typedef (TestDict or TestCallback) TestUnionCallbackDict;
        """
    )
    results = parser.finish()

    harness.ok(True"TestUnionCallbackDict interface parsed without error")
    harness.check(len(results), 3, "Document should have 3 types")

    myDict = results[0]
    harness.ok(isinstance(myDict, WebIDL.IDLDictionary), "Expect an IDLDictionary")

    myCallback = results[1]
    harness.ok(isinstance(myCallback, WebIDL.IDLCallback), "Expect an IDLCallback")

    myUnion = results[2]
    harness.ok(isinstance(myUnion, WebIDL.IDLTypedef), "Expect a IDLTypedef")
    harness.ok(
        isinstance(myUnion.innerType, WebIDL.IDLUnionType), "Expect a IDLUnionType"
    )
    harness.ok(
        isinstance(myUnion.innerType.memberTypes[0], WebIDL.IDLWrapperType),
        "Expect a IDLDictionary",
    )
    harness.ok(
        isinstance(myUnion.innerType.memberTypes[1], WebIDL.IDLCallbackType),
        "Expect a IDLCallbackType",
    )
    harness.ok(
        (myUnion.innerType.memberTypes[0].inner == myDict),
        "Expect right Union member to be MyDict",
    )
    harness.ok(
        (myUnion.innerType.memberTypes[1].callback == myCallback),
        "Expect left Union member to be MyCallback",
    )

Messung V0.5
C=100 H=100 G=100

¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge