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)
|
||||
(!indent* distance))
|
||||
(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")]
|
||||
[#t (! "#true")]
|
||||
[(? single-flonum?) (! "~vf" v)]
|
||||
[(? single-flonum?) (! "~vf" (real->double-flonum v))]
|
||||
[(? double-flonum?) (! "~v" v)]
|
||||
[(? integer? x) (! "~v" v)]
|
||||
[(? string?)
|
||||
|
@ -993,6 +1004,11 @@
|
|||
(check-equal? (d-strip binary-form) back loc)
|
||||
(check-equal? (d binary-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))
|
||||
(check-equal? (encode forward) binary-form loc))
|
||||
(unless (memq variety '(nondeterministic streaming))
|
||||
|
|
Loading…
Reference in New Issue