Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added a few more tests.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | asTypedList
Files: files | file ages | folders
SHA3-256: 96986493f8f1dac05ad5ae12a066e9ff63034a22bc14a2a44a2a4edaff9f16eb
User & Date: rolf 2024-09-27 16:01:00
Context
2024-09-27
16:04
Added the asTypedList method to the domDoc and domNode commands. Added the createFromTypedList method to the dom command. check-in: 25ef75c805 user: rolf tags: trunk
16:01
Added a few more tests. Closed-Leaf check-in: 96986493f8 user: rolf tags: asTypedList
12:17
Merged from trunk. check-in: 78a7f45535 user: rolf tags: asTypedList
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/domjson.test.

3036
3037
3038
3039
3040
3041
3042

















3043
3044
3045
3046
3047
3048
3049
        set doc [dom parse -json $json]
        lappend result [$doc asTypedList]
        $doc delete
    }
    set result
} {{STRING {string foo}} NULL TRUE FALSE {NUMBER -1.23}}


















if {[info commands _dom] eq ""} {

test json-12.1 {createFromTypedList} {
    set doc [dom createFromTypedList {OBJECT {Titel {STRING Wirtschaftsinformatik} Keywords {ARRAY {{STRING Introduction} {STRING Basics}}} Year {NUMBER 2022}}}]
    set result [$doc asJSON]
    $doc delete
    set result







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
        set doc [dom parse -json $json]
        lappend result [$doc asTypedList]
        $doc delete
    }
    set result
} {{STRING {string foo}} NULL TRUE FALSE {NUMBER -1.23}}

test json-11.5 {asTypedList} {
    set result ""
    set json {{
        "Keywords": ["Introduction","Basics"],
        "Data": {"one": "two", "three": true},
        "Titel": "Wirtschaftsinformatik"
    }}
    set doc [dom parse -json $json]
    set node [$doc firstChild]
    while {$node ne ""} {
        lappend result [$node asTypedList]
        set node [$node nextSibling]
    }
    $doc delete
    set result
} {{ARRAY {{STRING Introduction} {STRING Basics}}} {OBJECT {one {STRING two} three TRUE}} {STRING Wirtschaftsinformatik}}

if {[info commands _dom] eq ""} {

test json-12.1 {createFromTypedList} {
    set doc [dom createFromTypedList {OBJECT {Titel {STRING Wirtschaftsinformatik} Keywords {ARRAY {{STRING Introduction} {STRING Basics}}} Year {NUMBER 2022}}}]
    set result [$doc asJSON]
    $doc delete
    set result