Closed gvwilson closed 6 years ago
@gvwilson This is related to https://github.com/datacamp/learn-features/issues/14, and shellwhat
is not the place to fix this. The issue is on the backend level, so closing it here. Good to see the conversation going on the learn-features issue, though!
We need to be able to lie to our learners in our shell courses (shell and Git). Here's the use case:
We want the learner to run
nano config.txt
to create a new a configuration file.If we put that in the solution block for the exercise, automated testing fails (because we go into the editor and never come out).
So instead we use
echo nano config.txt
and usetest_student_typed
with the regular expression'.*nano\s+config\.txt.*'
to check.That makes the SCT pass, but when the learner asks to see the solution, they see the extra
echo
command rather than just thenano
command.In other exercises, the solution is
cp /solutions/config.txt ./config.txt
to copy a file with the correct data from the/solutions
directory created when the Docker image is built into the right place. Again, this gets a file comparison SCT to pass, but when the learner looks at the solution, they don't see what we want them to see.We run into something similar when we're teaching the
man
command. If the solution code is:then automated testing fails, because
man cut
launchesless
, which hangs up waiting for the user to typeq
. To prevent this, we use:as the solution, because piping the output of
man
to another command suppresses the launch of the pager. Again, when the learner asks for the solution, they see something different from what they should run.