After getting both directories prepared, I used the command bash script.sh > results.txt
to save the results in two different results.txt
files.
Then, I ran the command diff lab9/markdown-parse/results.txt CSE15L-Platypus/results.txt
to compare the two different results. The output is shown below. I can see the differences line by line.
For example:
212c212
< [url]
---
> []
These lines mean that on line 212, the results in the markdown-parse
directory contained [url]
, while the results in the CSE15L-Platypus
directory contained []
.
(1) The first set of files I chose was 201.md, which caused the difference in line 230. The result from the provided directory is [baz]
, but the result from CSE15L-Platypus
is []
.
The actual code is:
I think the CSE15L-Platypus
implementation is correct, because the excepted output should be []
for this file. The bug in markdown-parse
file is that when there’s contents between the brackets and the parentheses, it still takes the code as a valid URL. As a result, before detecting the parentheses, the program should detect if there are contents between the brackets and the parentheses. If so, the line should not be regarded as a valid URL.
(2) The second set of files I chose was 342.md, which caused the difference in line 230. The result from the provided directory is [/foo`], but the result from CSE15L-Platypus is [].
The actual code is:
I think the CSE15L-Platypus
implementation is correct, because the excepted output should be []
for this file. The bug in markdown-parse
file is that when there’s a set of grave accent (`) symbols inside the link, it should no longer be considered as a valid URL. As a result, a possible solution can be detecting if there’s grave accent symbols between the brackets and the parentheses. The detection could be added while we detect the brackets.