(define (refine-main)
(display next-string) ;;feito
(set! next-command (shell-parser (my-read-line))) ;;TODO my-read-line
(execute next-command) ;;TODO execute
(refine-main)) ;;feito
This is refine-main
"shell-parser" is just a PEG-based parser, that return a struct
"execute" in the case of reading a "exit 0" just call (exit 0)
Em dom, 17 de fev de 2019 às 16:07, Joao Pedro Abreu De Souza <
[email protected]> escreveu:
> Well, there's no imediate return, i need to type exit 0 to finally the
> test works
>
> I am using read-line to read input. Today later I will post more code(of
> refine-main).
>
> Thanks
>
> Em dom, 17 de fev de 2019 10:37, Greg Hendershott <
> [email protected] escreveu:
>
>> What does it do? Does `check-equal?` show a failure message? If so,
>> what does it say?
>>
>>
>> I don't know what `refine-main` does, but this simple version works for
>> me:
>>
>> #lang racket
>>
>> (require rackunit)
>>
>> (define (refine-main)
>> (display (read-line))) ;echo
>>
>> (check-equal?
>> (with-output-to-string
>> (lambda ()
>> (with-input-from-string "input"
>> (lambda ()
>> (refine-main)))))
>> "input")
>>
>> On Sun, Feb 17, 2019 at 12:35 AM Joao Pedro Abreu De Souza
>> <[email protected]> wrote:
>> >
>> > Hi everyone. I have a test of a user-related function that I don't can
>> see why don't work :
>> >
>> > #lang racket
>> >
>> > (require rackunit)
>> > (require "../../main.rkt")
>> >
>> >
>> >
>> >
>> > (check-equal?
>> > (with-output-to-string (lambda ()
>> > (with-input-from-string
>> > "exit 0"
>> > (lambda () (refine-main)))))
>> > ""
>> > "Consigo sair antes de comecar o tutorial")
>> >
>> >
>> >
>> >
>> > I think that this will call refine-main and, when refine-main do a
>> readline, will receive "exit 0" as string, and when display something, will
>> appear as return of with-output-to-string, but this code don't work :(
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "Racket Users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to [email protected].
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.