Replies: 11 comments 45 replies
-
I'm still stuck. The following code snippit still produces the following output. What am I doing wrong?
|
Beta Was this translation helpful? Give feedback.
-
So after a LOT of trying. I've dumbed down everything to the following:
I check whether sheldon->command_line exists. which saves the pain of redirection stuff and so forth.
This 'works' as it successfully prints the whole ast shown below:
If I uncomment I get the following output:
|
Beta Was this translation helpful? Give feedback.
-
Well, there's a few things that make unit-testing readline() impractical, but besides that, I think I'd expect this to work. What is your executor function doing? From the error message above, it looks like it's trying to call some criterion function after forking; that is definitely not possible, as the PID is used to identify which test is sending the message. Going back to your initial test, you can't really rewind the redirected stdin, because it's a pipe. I'm not sure the buffering on it is also line-based, so you'd need to call |
Beta Was this translation helpful? Give feedback.
-
it is roughly doing this in the case that it only accepts one command like ls:
I will retry my inital test with fflush() |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
So I'm not exactly sure, but right now it even seems to work as expected:
Gives this as output:
|
Beta Was this translation helpful? Give feedback.
-
I have one more question. Is there a criterion function to debug the stdout/stderr? |
Beta Was this translation helpful? Give feedback.
-
My apologies for having so many questions. It cannot be understated how much your help is appreciated.
My test just passes.
Am I missing something?
|
Beta Was this translation helpful? Give feedback.
-
So I've created the following function that is being called in a loop. I'm not sure how to properly test it. Preferably I'd like to give readline two separate commands: 1. "ls" 2. "exit". This would issue the command once and then exit the loop. As a bonus I'd also like to compare the result of the "ls" command but that's only optional. Does anyone have any ideas how I could achieve this using criterion?
Executing this produces the following output:
Running:
Prints on the stdout:
Sheldon$ exit
So this test should fail
Beta Was this translation helpful? Give feedback.
All reactions