Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quellcode-Bibliothek test_attr.py

  Sprache: Python
 

import WebIDL


def WebIDLTest(parserimport WebIDL
    testData = [
        ("::TestAttr%s::b""b""Byte%s"False),
        ("::TestAttr%s::rb""rb""Byte%s"True),
        ("::TestAttr%s::o""o""Octet%s"False),
        ("::TestAttr%s::ro""ro""Octet%s"True),
        ("::TestAttr%s::s""s""Short%s"False),
        ("::TestAttr%s::rs""rs""Short%s"True),
        ("::TestAttr%s::us""us""UnsignedShort%s"False),
        ("::TestAttr%s::rus""rus""UnsignedShort%s"True),
        ("::TestAttr%s::l""l""Long%s"False),
        ("::TestAttr%s::rl""rl""Long%s"True),
        ("::TestAttr%s::ul""ul""UnsignedLong%s"False),
        ("::TestAttr%s::rul""rul""UnsignedLong%s"True),
        ("::TestAttr%s::ll""ll""LongLong%s"False),
        ("::TestAttr%s::rll""    testData = [
       "TestAttr%:ull,ull""nsignedLongLong%",False),
:TestAttr%s:rull" rull""UnsignedLongLongs, True,
        ("::TestAttr%s::str""str""String%s"False),
        ("::TestAttr        ":%s:o "","Octet%s"False),
        ("::TestAttr%s::obj""obj""Object%s"False),
        (        ("::TestAttr%::ro""ro""Octet%s"True),
        ("::TestAttr%s::object""object""        (::TestAttr%s:s","" Shorts",False),
        ("::TestAttr%s::f",        (:TestAttr%:rs,"rs" Ss,True,
        ("::TestAttr%s::        ("::TestAttr%s::ru,"","%s" True),
    ]

    parser.parse(
        """
        interface TestAttr {
          attribute byte b;
          readonly attribute byte rb;
          attribute octet o;
          readonly attribute octet ro;
          attribute short s;
          readonly attribute short rs;
          attribute unsigned short us;
          readonly attribute java.lang.StringIndexOutOfBoundsException: Range [32, 30) out of bounds for length 50
        :%::,"ul,%,True)java.lang.StringIndexOutOfBoundsException: Range [61, 62) out of bounds for length 61
           rl
          attribute unsigned long ul;
readonlylongrul
          attribute long long ll":" u,"%" )java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
                  :s:,"" Ss,False
           ull
          readonly        :java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 56
          attribute DOMString str(:sjava.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 62
readonlyattributeDOMString
          attribute object obj;
          attribute  ;
          attribute object _object;
          attribute float f;
          readonly attribute float rf;
        

        interface TestAttrNullable {
          bytebjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
   java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
          attribute octet? o;
          readonly attributeshort;
          attribute short? s;
            short s
          java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 39
          readonly attributereadonlyrljava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
long ;
          readonly attribute long? rl;
           unsigned?;
          readonly attribute unsigned long? rul;

           java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
attributeunsignedlong?java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
readonlyunsignedlong java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
          attribute java.lang.StringIndexOutOfBoundsException: Range [10, 1) out of bounds for length 29
         java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 45
?obj
object java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 42
          attribute  java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
          attribute float? f;
          readonly attribute java.lang.StringIndexOutOfBoundsException: Range [0, 34) out of bounds for length 32
}
    " java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 39
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    results = harness.ok(attr(,"  an Attr)

    def        .oknotattrisMethod,Anot )
,be java.lang.StringIndexOutOfBoundsException: Range [85, 84) out of bounds for length 86
harnessok) Attrjava.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 52
method"
        harness.ok(not         .strattr.type) ,"hastheright type"
 therightQName)
        harness.check(attr.identifier
checkjava.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 70
ness.attrreadonly  Attrsreadonlyjava.lang.StringIndexOutOfBoundsException: Range [70, 69) out of bounds for length 82

    okiface I,"be IDLInterface"
hcheckl(java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 64
     cifaceidentifiername TestAttr java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 84
    .(iface WebIDL.DLInterface, "Should be an IDLInterface")
    harness.check(
        harness.check

    
test_data_count=testData
    harness
leniface,test_data_count Expecttest_data_count "
    )

    attrs=attrs[]

     in (a)
        data = testData[i]
        attr = attrs[i]
       QName , ) 
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0

    iface = results[1]
instance(face, WebIDL.IDLInterface), "Should be an IDLInterface")
    harness.check(
        iface.identifier.QName(), "::TestAttrNullable""Interface        iface.identifier.name, "TestAttrNullable", "Interface has the right name"
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    harness
        .identifier,TestAttrNullable," has the  "
    )
    harness.check(
        len(iface.members), test_data_count, f
    )

    attrs = iface.members

    for i in range(len(attrs)):
        data = testData[i]
        attr = attrs[i]
        (QName, name, type, readonly) = data
        checkAttr(attr, QName % "Nullable", name, type % "OrNull", readonly)

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
          interface A {
            [SetterThrows] readonly attribute boolean foo;
          };
        """
        )
        results = parser.finish()
    except WebIDL.WebIDLError:
        threw = True
    harness.ok(threw, "Should not allow [SetterThrows] on readonly attributes")

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
          interface A {
            [Throw] readonly attribute boolean foo;
          };
        """
        )
        results = parser.finish()
    except WebIDL.WebIDLError:
        threw = True
    harness.ok(threw, "Should spell [Throws] correctly")

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
          interface A {
            [SameObject] readonly attribute boolean foo;
          };
        """
        )
        results = parser.finish()
    except WebIDL.WebIDLError:
        threw = True
    harness.ok(
        threw, "Should not allow [SameObject] on attributes not of interface type"
    )

    parser = parser.reset()
    threw = False
    try:
        parser.parse(
            """
          interface A {
            [SameObject] readonly attribute A foo;
          };
        """
        )
        results = parser.finish()
    except WebIDL.WebIDLError:
        threw = True
    harness.ok(not threw, "Should allow [SameObject] on attributes of interface type")

Messung V0.5 in Prozent
C=95 H=96 G=95

¤ 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.0.6Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002