Skip to content

Commit

Permalink
uri empty string edge case
Browse files Browse the repository at this point in the history
NotLe0n committed Nov 24, 2024
1 parent a24727f commit a7a1c51
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/stdlib/Duden/Uri.ddp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Binde "Duden/Regex" ein.
Binde "Duden/Ausgabe" ein.
Binde "Duden/Texte" ein.
Binde "Duden/Fehlerbehandlung" ein.

@@ -20,6 +19,7 @@ Der Text uri_regex ist "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*)
Der Text authority_regex ist "^((.+)@)?((\\[[:0-9A-Fa-f.]+\\])|([a-zA-Z0-9\\-\\._~!$&'\\(\\)\\*\\+,;=])*)(:(\\d+))?".
Die öffentliche Funktion Parse_Uri mit dem Parameter uri vom Typ Text, gibt eine Uri zurück, macht:
Diese Funktion könnte einen Fehler melden.
Wenn uri leer ist, gib eine leere Uri zurück.

Der Treffer t ist der erste Treffer von uri_regex in uri.
Wenn es dabei einen Fehler gab oder (text von t) leer ist,
1 change: 1 addition & 0 deletions tests/testdata/stdlib/Uri/Uri.ddp
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ Die Funktion Schreibe_Uri_Komponente mit dem Parameter uri vom Typ Uri, gibt nic
Und kann so benutzt werden:
"Schreibe <uri>"

Schreibe ("" als Uri).
Schreibe ("https://user:[email protected]:8080/index.html?a=hi&b=bye#anchor" als Uri).
Schreibe ("https://de.wikipedia.org/wiki/Uniform_Resource_Identifier" als Uri).
Schreibe ("ftp://ftp.is.co.za/rfc/rfc1808.txt" als Uri).
1 change: 1 addition & 0 deletions tests/testdata/stdlib/Uri/expected.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
| | | | | | |
https://user:[email protected]:8080/index.html?a=hi&b=bye#anchor | https | user:password | example.com | 8080 | /index.html | a=hi&b=bye | anchor
https://de.wikipedia.org/wiki/Uniform_Resource_Identifier | https | | de.wikipedia.org | | /wiki/Uniform_Resource_Identifier | |
ftp://ftp.is.co.za/rfc/rfc1808.txt | ftp | | ftp.is.co.za | | /rfc/rfc1808.txt | |

0 comments on commit a7a1c51

Please sign in to comment.