Skip to content

Latest commit

 

History

History
77 lines (54 loc) · 4.74 KB

lab-report-4.md

File metadata and controls

77 lines (54 loc) · 4.74 KB

Lab Report 4

My Solution to the Lab Challenge

Log into ieng6

Keys Pressed:
<ctrl+r> s <enter>

The ssh command has been used many times, so it's stored in my bash history. With a simple search for s, I'm able to access that command.

Clone your fork of the repository from your Github account

Keys Pressed:
git clone <cmd+v> <enter>
(Repo URL was already in clipboard)

I typed out git clone and then pasted the already copied repository URL to speed up the process.

Run the tests, demonstrating that they fail

Keys Pressed:
cd l <tab> <enter>
<ctrl+r> javac - <enter>
<ctrl+r> java - <enter>

The first line becomes cd lab7/. Tabbing allows bash to autocomplete the directory that I change into.
The second and third lines search for bash history for the javac and java commands with the correct classpath respectively.
They become: javac -cp .:lib/hamcrest-core-1.3.jar:lib/junit-4.13.2.jar *.java and java -cp .:lib/hamcrest-core-1.3.jar:lib/junit-4.13.2.jar org.junit.runner.JUnitCore ListExamplesTests respectively.

Edit the code file to fix the failing test

Keys Pressed:
nano Li <tab> .j <tab> <enter>
<ctrl+w> while (index2 <enter>
<down> 2 times, <right> 8 times
<backspace> 2
<ctrl+o> <enter> <ctrl+x>

The first line becomes nano ListExamples.java. I allow for bash to autocomplete the file for me; it first completes to ListExamples, since there is also a ListExamples.class file in the directory. Then, I clarify with ListExamples.j which is unique.
Next, I search for while(index2 in the file and fix the buggy line that may create an infinite while loop.
Then, using <ctrl+o> <enter> I save the file and leave the nano editor with <ctrl+x>

Run the tests, demonstrating that they now succeed

Keys Pressed:
javac L <tab> .j <tab> <enter>
<up> x3 <enter>

I compile the newly editted file with the javac command; similarly to before, I allow bash to autocomplete ListExamples.java. The whole command is javac ListExamples.java
Since we just ran the java -cp command earlier to run the Tester file, we can directly go back in our history to run it by pressing the <up> arrow keys. It should be: java -cp .:lib/hamcrest-core-1.3.jar:lib/junit-4.13.2.jar org.junit.runner.JUnitCore ListExamplesTests

Commit and push the resulting change to your Github account

Keys Pressed:
git add L <tab> .j <tab> <enter>
git commit -m “fixed” <enter>
git push <enter>
Once again, I allow bash to autocomplete ListExamples.java, which makes the first line git add ListExamples.java.
Then, I commit the added file with the message "fixed".
Finally, I push the commit to GitHub with git push.