diff --git a/README.md b/README.md index c5ef7f7..5861f49 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,13 @@ It features * Relative reference parsing and resolution * URL normalization * Doesn't rely on null-terminated strings + +# Usage +You just copy paste `url.h` and `url.c` in your source tree and compile them as usual. + +Some example programs are provided in the `examples/` folder. To compile them, run `build.bat` on Windows or `build.sh` on Linux. + +# Testing +The parser and reference resolver is tested against the URL section of the [web platform tests](https://github.com/web-platform-tests/wpt). Note that not all tests pass. This is due to the parser not doing any normalization and not supporting more niche features such as converting `\` characters to `/` or supporting drive letters like `C:` in the URL's path. + +To run the test suite, `cd` into `tests/` and compile the test runner using `build.sh` (Linux) or `build.bat` (Windows). Then, run `./test.out` (Linux) or `./test.exe` (Windows). diff --git a/tests/Makefile b/tests/Makefile deleted file mode 100644 index 7b068ab..0000000 --- a/tests/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -.PHONY: all clean - -ifeq ($(shell uname -s),Windows_NT) - EXT = .exe -else - EXT = .out -endif - -all: - gcc -o test$(EXT) test.c ../url.c cJSON.c -Wall -Wextra -ggdb - -clean: - rm test.out test.exe diff --git a/tests/build.bat b/tests/build.bat new file mode 100644 index 0000000..3764f98 --- /dev/null +++ b/tests/build.bat @@ -0,0 +1 @@ +gcc -o test.exe test.c ../url.c cJSON.c -Wall -Wextra -ggdb diff --git a/tests/build.sh b/tests/build.sh new file mode 100644 index 0000000..87f56b7 --- /dev/null +++ b/tests/build.sh @@ -0,0 +1 @@ +gcc -o test.out test.c ../url.c cJSON.c -Wall -Wextra -ggdb