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 3 kB image not shown  

Quelle  test_cereactions.py   Sprache: Python

 
import WebIDL


def WebIDLTest(parser, harness):
    threw = False
    try:
        parser.parse(
            """
            interface Foo {
              [CEReactions(DOMString a)] undefined foo(boolean arg2);
            };
        """
        )

        parser.finish()
    except WebIDL.WebIDLError:
        threw = True

    harness.ok(threw, "Should have thrown for [CEReactions] with an argument")

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
            interface Foo {
              [CEReactions(DOMString b)] readonly attribute boolean bar;
            };
        """
        )

        parser.finish()
    except WebIDL.WebIDLError:
        threw = True

    harness.ok(threw, "Should have thrown for [CEReactions] with an argument")

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
            interface Foo {
              [CEReactions] attribute boolean bar;
            };
        """
        )

        parser.finish()
    except Exception as e:
        harness.ok(
            False,
            "Shouldn't have thrown for [CEReactions] used on writable attribute. %s"
            % e,
        )
        threw = True

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
            interface Foo {
              [CEReactions] undefined foo(boolean arg2);
            };
        """
        )

        parser.finish()
    except Exception as e:
        harness.ok(
            False,
            "Shouldn't have thrown for [CEReactions] used on regular operations. %s"
            % e,
        )
        threw = True

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
            interface Foo {
              [CEReactions] readonly attribute boolean A;
            };
        """
        )

        parser.finish()
    except WebIDL.WebIDLError:
        threw = True

    harness.ok(
        threw, "Should have thrown for [CEReactions] used on a readonly attribute"
    )

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
            [CEReactions]
            interface Foo {
            }
        """
        )

        parser.finish()
    except WebIDL.WebIDLError:
        threw = True

    harness.ok(threw, "Should have thrown for [CEReactions] used on a interface")

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
          interface Foo {
            [CEReactions] getter any(DOMString name);
          };
        """
        )
        parser.finish()
    except WebIDL.WebIDLError:
        threw = True

    harness.ok(threw, "Should have thrown for [CEReactions] used on a named getter")

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
          interface Foo {
            [CEReactions] legacycaller double compute(double x);
          };
        """
        )
        parser.finish()
    except WebIDL.WebIDLError:
        threw = True

    harness.ok(threw, "Should have thrown for [CEReactions] used on a legacycaller")

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
          interface Foo {
            [CEReactions] stringifier DOMString ();
          };
        """
        )
        parser.finish()
    except WebIDL.WebIDLError:
        threw = True

    harness.ok(threw, "Should have thrown for [CEReactions] used on a stringifier")

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

¤ 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.