Link to my markdown-parse
Link to someone else’s markdown-parse
For each of the MarkeDownParseTest files, I added the following 3 tests for the three files:
Each of the three files, “lab-report-4-1.md”, “lab-report-4-2.md”, “lab-report-4-3.md”, has the following code:
lab-report-4-1.md (Code Snippet 1)
`[a link`](url.com)
[another link](`google.com)`
[`cod[e`](google.com)
[`code]`](ucsd.edu)
expected output:
["`google.com", "google.com", "ucsd.edu"]
lab-report-4-2.md (Code Snippet 2)
[a [nested link](a.com)](b.com)
[a nested parenthesized url](a.com(()))
[some escaped \[ brackets \]](example.com)
expected output:
["a.com", "a.com(())", "example.com"]
lab-report-4-3.md (Code Snippet 3)
[this title text is really long and takes up more than
one line
and has some line breaks](
https://www.twitter.com
)
[this title text is really long and takes up more than
one line](
https://sites.google.com/eng.ucsd.edu/cse-15l-spring-2022/schedule
)
[this link doesn't have a closing parenthesis](github.com
And there's still some more text after that.
[this link doesn't have a closing parenthesis for a while](https://cse.ucsd.edu/
)
And then there's more text
expected output:
["https://www.twitter.com", "https://sites.google.com/eng.ucsd.edu/cse-15l-spring-2022/schedule", "https://cse.ucsd.edu/"]
My Implementation
All the previous tests succeed, but the 3 new ones fail. Instead of the expected output, the three tests output:
[url.com, `google.com, google.com, ucsd.edu]
[a.com, a.com((, example.com]
[ https://www.twitter.com , https://sites.google.com/eng.ucsd.edu/cse-15l-spring-2022/schedule , github.com
And there’s still some more text after that.
[this link doesn’t have a closing parenthesis for a while](https://cse.ucsd.edu/
]
Reviewed Implementation
Previous implements including the new 3 fail. Instead of the expected output, the three tests output:
[url.com, `google.com, google.com, ucsd.edu]
[a.com, a.com((, example.com]
[]
A small (<10 lines) code change that can make my program work:
Code Snippet 1
Code Snippet 2
Code Snippet 3
Now all the tests pass! I probably didn’t actually have to debug it but I went all out