feat: Rename parse_uri.sh to uri.sh
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
#! /usr/bin/env bats
 | 
			
		||||
 | 
			
		||||
# lib/parse_uri.sh tests.
 | 
			
		||||
# parse_uri() from lib/uri.sh tests.
 | 
			
		||||
# See: https://bats-core.readthedocs.io/en/latest/index.html
 | 
			
		||||
 | 
			
		||||
setup() {
 | 
			
		||||
@@ -16,7 +16,7 @@ setup() {
 | 
			
		||||
# ------------------------------ #
 | 
			
		||||
 | 
			
		||||
@test "Test file:/" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'file:/'
 | 
			
		||||
    [ "$scheme" == 'file' ]
 | 
			
		||||
    [ "$hostname" == '' ]
 | 
			
		||||
@@ -29,7 +29,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test file:/path" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'file:/path'
 | 
			
		||||
    [ "$scheme" == 'file' ]
 | 
			
		||||
    [ "$hostname" == '' ]
 | 
			
		||||
@@ -42,7 +42,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test file:///" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'file:///'
 | 
			
		||||
    [ "$scheme" == 'file' ]
 | 
			
		||||
    [ "$hostname" == '' ]
 | 
			
		||||
@@ -55,7 +55,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test sqlite:///path" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'sqlite:///path'
 | 
			
		||||
    [ "$scheme" == 'sqlite' ]
 | 
			
		||||
    [ "$hostname" == '' ]
 | 
			
		||||
@@ -68,7 +68,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test file://host" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'file://host'
 | 
			
		||||
    [ "$scheme" == 'file' ]
 | 
			
		||||
    [ "$hostname" == 'host' ]
 | 
			
		||||
@@ -81,7 +81,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test s3://host/path" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 's3://host/path'
 | 
			
		||||
    [ "$scheme" == 's3' ]
 | 
			
		||||
    [ "$hostname" == 'host' ]
 | 
			
		||||
@@ -94,7 +94,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test dav://user@host/" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'dav://user@host/'
 | 
			
		||||
    [ "$scheme" == 'dav' ]
 | 
			
		||||
    [ "$hostname" == 'host' ]
 | 
			
		||||
@@ -107,7 +107,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test dav://user:p%40%24%24w0rD@host/path/" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'dav://user:p%40%24%24w0rD@host/path/'
 | 
			
		||||
    [ "$scheme" == 'dav' ]
 | 
			
		||||
    [ "$hostname" == 'host' ]
 | 
			
		||||
@@ -120,7 +120,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test rsync://user:password@host:~/backups" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'rsync://user:password@host:~/backups'
 | 
			
		||||
    [ "$scheme" == 'rsync' ]
 | 
			
		||||
    [ "$hostname" == 'host' ]
 | 
			
		||||
@@ -133,7 +133,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test postgres://user:password@host:5432" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'postgres://user:password@host:5432'
 | 
			
		||||
    [ "$scheme" == 'postgres' ]
 | 
			
		||||
    [ "$hostname" == 'host' ]
 | 
			
		||||
@@ -146,7 +146,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test http://user:password@host:port/path?q=val" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'scheme://user:password@host:123/path?q=val'
 | 
			
		||||
    [ "$scheme" == 'scheme' ]
 | 
			
		||||
    [ "$hostname" == 'host' ]
 | 
			
		||||
@@ -159,7 +159,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test ftp://user:%24t%D0%AFo%7C%5C%7C6@[fe80::5054:ff:fe24:382]:2021/srv/" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'ftp://user:%24t%D0%AFo%7C%5C%7C6@[fe80::5054:ff:fe24:382]:2021/srv/'
 | 
			
		||||
    [ "$scheme" == 'ftp' ]
 | 
			
		||||
    [ "$hostname" == '[fe80::5054:ff:fe24:382]' ]
 | 
			
		||||
@@ -176,7 +176,7 @@ setup() {
 | 
			
		||||
# ------------------------------ #
 | 
			
		||||
 | 
			
		||||
@test "Test https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top'
 | 
			
		||||
    [ "$scheme" == 'https' ]
 | 
			
		||||
    [ "$hostname" == 'www.example.com' ]
 | 
			
		||||
@@ -189,7 +189,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test ldap://[2001:db8::7]/c=GB?objectClass?one" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'ldap://[2001:db8::7]/c=GB?objectClass?one'
 | 
			
		||||
    [ "$scheme" == 'ldap' ]
 | 
			
		||||
    [ "$hostname" == '[2001:db8::7]' ]
 | 
			
		||||
@@ -202,7 +202,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test mailto:John.Doe@example.com" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'mailto:John.Doe@example.com'
 | 
			
		||||
    [ "$scheme" == 'mailto' ]
 | 
			
		||||
    [ "$hostname" == '' ]
 | 
			
		||||
@@ -215,7 +215,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test news:comp.infosystems.www.servers.unix" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'news:comp.infosystems.www.servers.unix'
 | 
			
		||||
    [ "$scheme" == 'news' ]
 | 
			
		||||
    [ "$hostname" == '' ]
 | 
			
		||||
@@ -228,7 +228,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test tel:+1-816-555-1212" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'tel:+1-816-555-1212'
 | 
			
		||||
    [ "$scheme" == 'tel' ]
 | 
			
		||||
    [ "$hostname" == '' ]
 | 
			
		||||
@@ -242,7 +242,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test telnet://192.0.2.16:80/" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'telnet://192.0.2.16:80/'
 | 
			
		||||
    [ "$scheme" == 'telnet' ]
 | 
			
		||||
    [ "$hostname" == '192.0.2.16' ]
 | 
			
		||||
@@ -255,7 +255,7 @@ setup() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@test "Test urn:oasis:names:specification:docbook:dtd:xml:4.1.2" {
 | 
			
		||||
    . parse_uri.sh
 | 
			
		||||
    . uri.sh
 | 
			
		||||
    parse_uri 'urn:oasis:names:specification:docbook:dtd:xml:4.1.2'
 | 
			
		||||
    [ "$scheme" == 'urn' ]
 | 
			
		||||
    [ "$hostname" == '' ]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user