- (let* ([ts "2020-11-18T22:22:09-0500"]
- [tab " "]
- [text "Lorem ipsum"]
- [nick "foo"]
- [uri "bar"]
- [actual (str->msg nick uri (string-join (list ts text) tab))]
- [expected (msg 1605756129 ts nick uri text)])
- ; FIXME re-enable after handling tz offset
- ;(check-equal?
- ; (msg-ts_epoch actual)
- ; (msg-ts_epoch expected)
- ; "str->msg ts_epoch")
- (check-equal?
- (msg-ts_rfc3339 actual)
- (msg-ts_rfc3339 expected)
- "str->msg ts_rfc3339")
- (check-equal?
- (msg-nick actual)
- (msg-nick expected)
- "str->msg nick")
- (check-equal?
- (msg-uri actual)
- (msg-uri expected)
- "str->msg uri")
- (check-equal?
- (msg-text actual)
- (msg-text expected)
- "str->msg text")))
+ (let* ([tzs (for*/list ([d '("-" "+")]
+ [h '("5" "05")]
+ [m '("00" ":00" "57" ":57")])
+ (string-append d h m))]
+ [tzs (list* "" "Z" tzs)])
+ (for* ([n '("fake-nick")]
+ [u '("fake-uri")]
+ [s '("" ":10")]
+ [f '("" ".1337")]
+ [z tzs]
+ [sep (list "\t" " ")]
+ [txt '("foo bar baz" "'jaz poop bear giraffe / tea" "@*\"``")])
+ (let* ([ts (string-append "2020-11-18T22:22"
+ (if (non-empty-string? s) s ":00")
+ z)]
+ [m (str->msg n u (string-append ts sep txt))])
+ (check-not-false m)
+ (check-equal? (msg-nick m) n)
+ (check-equal? (msg-uri m) u)
+ (check-equal? (msg-text m) txt)
+ (check-equal? (msg-ts_rfc3339 m) ts (format "Given: ~v" ts))
+ )))
+
+ (let* ([ts "2020-11-18T22:22:09-0500"]
+ [tab " "]
+ [text "Lorem ipsum"]
+ [nick "foo"]
+ [uri "bar"]
+ [actual (str->msg nick uri (string-append ts tab text))]
+ [expected (msg 1605756129 ts nick uri text)])
+ ; FIXME re-enable after handling tz offset
+ ;(check-equal?
+ ; (msg-ts_epoch actual)
+ ; (msg-ts_epoch expected)
+ ; "str->msg ts_epoch")
+ (check-equal?
+ (msg-ts_rfc3339 actual)
+ (msg-ts_rfc3339 expected)
+ "str->msg ts_rfc3339")
+ (check-equal?
+ (msg-nick actual)
+ (msg-nick expected)
+ "str->msg nick")
+ (check-equal?
+ (msg-uri actual)
+ (msg-uri expected)
+ "str->msg uri")
+ (check-equal?
+ (msg-text actual)
+ (msg-text expected)
+ "str->msg text")))