= Exercise 7.4
// Refs:
:url-base: https://github.com/fenegroni/TGPL-exercise-solutions
:workflow: workflows/Exercise 7.4
:action: actions/workflows/ch7ex4.yml
:url-workflow: {url-base}/{workflow}
:url-action: {url-base}/{action}
:badge-exercise: image:{url-workflow}/badge.svg?branch=main[link={url-action}]
{badge-exercise}
The `strings.NewReader` function returns a value that satisfies the `io.Reader` interface
(and others) by reading from its argument, a string.
Implement a simple version of `NewReader` yourself,
and use it to make the HTML parser take input from a string.
== Test
We use the same test we implemented for exercise 5.7
using the `outline` function to
build a string representation of an HTML document
given the parse tree got from `html.Parse`.
In this test we call `html.Parse` by calling our own implementation of `NewReader`
using the string from each test case.
As we can see from the implementation, out of the many interfaces our `Reader` has to satisfy
only the `io.Reader` interface needs to implemented for the test to pass.
Luckily for us, the other interfaces that `strings.Reader` implements are not called by `html.Parse`.