Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/dom/bindings/parser/tests/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  test_newobject.py   Sprache: Python

 
import WebIDL


# Import the WebIDL module, so we can do isinstance checks and whatnot
def WebIDLTest(parser, harness):
    # Basic functionality
    parser.parse(
        """
        interface Iface {
          [NewObject] readonly attribute Iface attr;
          [NewObject] Iface method();
        };
        """
    )
    results = parser.finish()
    harness.ok(results, "Should not have thrown on basic [NewObject] usage")

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
            interface Iface {
              [Pure, NewObject] readonly attribute Iface attr;
            };
            """
        )
        parser.finish()
    except WebIDL.WebIDLError:
        threw = True
    harness.ok(threw, "[NewObject] attributes must depend on something")

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
            interface Iface {
              [Pure, NewObject] Iface method();
            };
            """
        )
        parser.finish()
    except WebIDL.WebIDLError:
        threw = True
    harness.ok(threw, "[NewObject] methods must depend on something")

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
            interface Iface {
              [Cached, NewObject, Affects=Nothing] readonly attribute Iface attr;
            };
            """
        )
        parser.finish()
    except WebIDL.WebIDLError:
        threw = True
    harness.ok(threw, "[NewObject] attributes must not be [Cached]")

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
            interface Iface {
              [StoreInSlot, NewObject, Affects=Nothing] readonly attribute Iface attr;
            };
            """
        )
        parser.finish()
    except WebIDL.WebIDLError:
        threw = True
    harness.ok(threw, "[NewObject] attributes must not be [StoreInSlot]")

Messung V0.5
C=91 H=98 G=94

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© 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.