Some coverage of read/write text syntax
This commit is contained in:
parent
aa59846ee9
commit
2b74100b2a
|
@ -781,9 +781,20 @@
|
||||||
(write-value (+ distance 1) a)
|
(write-value (+ distance 1) a)
|
||||||
(!indent* distance))
|
(!indent* distance))
|
||||||
(write-value distance item)]
|
(write-value distance item)]
|
||||||
|
[(stream-of kind generator-thunk)
|
||||||
|
(define g (generator-thunk))
|
||||||
|
(define pieces (for/list [(p (in-producer g (void)))] p))
|
||||||
|
(write-value distance
|
||||||
|
(match kind
|
||||||
|
['string (bytes->string/utf-8 (bytes-append* pieces))]
|
||||||
|
['byte-string (bytes-append* pieces)]
|
||||||
|
['symbol (string->symbol (bytes->string/utf-8 (bytes-append* pieces)))]
|
||||||
|
['sequence pieces]
|
||||||
|
['set (list->set pieces)]
|
||||||
|
['dictionary (apply hash pieces)]))]
|
||||||
[#f (! "#false")]
|
[#f (! "#false")]
|
||||||
[#t (! "#true")]
|
[#t (! "#true")]
|
||||||
[(? single-flonum?) (! "~vf" v)]
|
[(? single-flonum?) (! "~vf" (real->double-flonum v))]
|
||||||
[(? double-flonum?) (! "~v" v)]
|
[(? double-flonum?) (! "~v" v)]
|
||||||
[(? integer? x) (! "~v" v)]
|
[(? integer? x) (! "~v" v)]
|
||||||
[(? string?)
|
[(? string?)
|
||||||
|
@ -993,6 +1004,11 @@
|
||||||
(check-equal? (d-strip binary-form) back loc)
|
(check-equal? (d-strip binary-form) back loc)
|
||||||
(check-equal? (d binary-form) annotated-text-form loc)
|
(check-equal? (d binary-form) annotated-text-form loc)
|
||||||
(check-equal? (d (encode annotated-text-form)) annotated-text-form loc)
|
(check-equal? (d (encode annotated-text-form)) annotated-text-form loc)
|
||||||
|
(check-equal? (string->preserve (preserve->string text-form)) back loc)
|
||||||
|
(check-equal? (string->preserve (preserve->string forward)) back loc)
|
||||||
|
(check-equal? (string->preserve-syntax (preserve->string annotated-text-form))
|
||||||
|
annotated-text-form
|
||||||
|
loc)
|
||||||
(unless (memq variety '(nondeterministic))
|
(unless (memq variety '(nondeterministic))
|
||||||
(check-equal? (encode forward) binary-form loc))
|
(check-equal? (encode forward) binary-form loc))
|
||||||
(unless (memq variety '(nondeterministic streaming))
|
(unless (memq variety '(nondeterministic streaming))
|
||||||
|
|
Loading…
Reference in New Issue