Advertisement
Guest User

Untitled

a guest
Feb 14th, 2025
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Racket 0.83 KB | None | 0 0
  1. #lang racket/base
  2.  
  3. (require racket/system racket/string)
  4.  
  5. (define (main)
  6.   (define args (vector->list (current-command-line-arguments)))
  7.   (define command (string-join args " "))
  8.   (define proc (process command))
  9.   (define repl-out (car proc))
  10.   (define repl-in (cadr proc))
  11.   (define err (cadddr proc))
  12.   (define repl (car (cddddr proc)))
  13.   (define input "((lambda (x) x) 123)")
  14.   (define expected "123")
  15.   (display input repl-in)
  16.   (newline repl-in)
  17.   (flush-output repl-in)
  18.   (display (repl 'status))
  19.   (newline)
  20.   (define actual (read-line repl-out))
  21.   (if (equal? actual expected)
  22.       (printf "Success! (~a)" actual)
  23.       (printf "Failure! (~a)" actual))
  24.   (newline)
  25.   (display (repl 'status))
  26.   (newline)
  27.   (close-input-port repl-out)
  28.   (close-input-port err)
  29.   (close-output-port repl-in)
  30.   (repl 'wait))
  31.  
  32. (main)
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement