Skip to content

Commit

Permalink
Renames Url.zig to Uri.zig
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix "xq" Queißner committed Jan 5, 2023
1 parent 3778356 commit 79877b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lib/std/Url.zig → lib/std/Uri.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Implements URI parsing roughly adhering to <https://tools.ietf.org/html/rfc3986>.
//! Does not do perfect grammar and character class checking, but should be robust against URIs in the wild.

const Url = @This();
const Uri = @This();
const std = @import("std.zig");
const testing = std.testing;

Expand Down Expand Up @@ -97,8 +97,8 @@ pub const ParseError = error{ UnexpectedCharacter, InvalidFormat, InvalidPort };
/// Parses the URI or returns an error.
/// The return value will contain unescaped strings pointing into the
/// original `text`. Each component that is provided, will be non-`null`.
pub fn parse(text: []const u8) ParseError!Url {
var uri = Url{
pub fn parse(text: []const u8) ParseError!Uri {
var uri = Uri{
.scheme = null,
.user = null,
.password = null,
Expand Down Expand Up @@ -311,7 +311,7 @@ test "with port" {
}

test "should fail gracefully" {
try std.testing.expectEqual(@as(ParseError!Url, error.InvalidFormat), parse("foobar://"));
try std.testing.expectEqual(@as(ParseError!Uri, error.InvalidFormat), parse("foobar://"));
}

test "scheme" {
Expand Down Expand Up @@ -413,7 +413,7 @@ test "authority.IPv6" {

test "RFC example 1" {
const uri = "foo://example.com:8042/over/there?name=ferret#nose";
try std.testing.expectEqual(Url{
try std.testing.expectEqual(Uri{
.scheme = uri[0..3],
.user = null,
.password = null,
Expand All @@ -427,7 +427,7 @@ test "RFC example 1" {

test "RFX example 2" {
const uri = "urn:example:animal:ferret:nose";
try std.testing.expectEqual(Url{
try std.testing.expectEqual(Uri{
.scheme = uri[0..3],
.user = null,
.password = null,
Expand Down
2 changes: 1 addition & 1 deletion lib/std/std.zig
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub const Target = @import("target.zig").Target;
pub const Thread = @import("Thread.zig");
pub const Treap = @import("treap.zig").Treap;
pub const Tz = tz.Tz;
pub const Url = @import("Url.zig");
pub const Uri = @import("Uri.zig");

pub const array_hash_map = @import("array_hash_map.zig");
pub const atomic = @import("atomic.zig");
Expand Down

0 comments on commit 79877b3

Please sign in to comment.