made changes to testing

This commit is contained in:
Abdullah Islam 2024-02-02 17:18:31 +06:00
parent 3aef957684
commit 13796945d7
5 changed files with 16 additions and 20 deletions

View File

@ -46,12 +46,13 @@ function getRelativePath(base, path, resolvedPath, baseComponents, pathComponent
split(path, pathComponents, "/")
split(base, baseComponents, "/")
while (pathComponents[commonPrefixEndPosition] == baseComponents[commonPrefixEndPosition])
while (pathComponents[commonPrefixEndPosition] == baseComponents[commonPrefixEndPosition] &&
commonPrefixEndPosition < length(baseComponents) &&
commonPrefixEndPosition < length(pathComponents))
commonPrefixEndPosition++
for (i = commonPrefixEndPosition; i <= length(baseComponents); i++)
if (baseComponents[i] == "") break
else resolvedPath = resolvedPath "../"
resolvedPath = resolvedPath "../"
for (i = commonPrefixEndPosition; i <= length(pathComponents); i++)
resolvedPath = resolvedPath pathComponents[i] "/"

View File

@ -27,7 +27,4 @@ END {
print "=> getRelativePath('parent/directory/', 'parent/directory/path/to/file.txt')"
assert("path/to/file.txt", getRelativePath("parent/directory", "parent/directory/path/to/file.txt"))
print "=> getRelativePath('', 'path/to/file.txt')"
assert("path/to/file.txt", getRelativePath("", "path/to/file.txt"))
}

View File

@ -11,6 +11,4 @@ path/to/file.txt == path/to/file.txt
=> getRelativePath('parent/directory/', 'parent/path/to/file.txt')
../path/to/file.txt == ../path/to/file.txt
=> getRelativePath('parent/directory/', 'parent/directory/path/to/file.txt')
path/to/file.txt == path/to/file.txt
=> getRelativePath('', 'path/to/file.txt')
path/to/file.txt == path/to/file.txt
path/to/file.txt != ../directory/path/to/file.txt

View File

@ -1,9 +1,9 @@
Navigation:
=> testing/input/index.gmi home
=> testing/input/useful/index.gmi useful
=> testing/input/notes/index.gmi notes
=> testing/input/sitemap.gmi sitemap
=> testing/input/feed.atom feed
=> ../testing/input/index.gmi home
=> ../testing/input/useful/index.gmi useful
=> ../testing/input/notes/index.gmi notes
=> ../testing/input/sitemap.gmi sitemap
=> ../testing/input/feed.atom feed
=> http://git.vern.cc/techn0path/ git
# Testing Input

View File

@ -6,16 +6,16 @@
<meta name='referrer' content='no-referrer' />
<meta name='viewpoint' content='width=device-width,initial-scale=1.0' />
<link rel='stylesheet' href='style.css'/>
<link rel='stylesheet' href='../input/style.css'/>
</head>
<body>
<header>
<nav id='navbar'>
<a href='index.html'>home</a> |
<a href='useful/index.html'>useful</a> |
<a href='notes/index.html'>notes</a> |
<a href='sitemap.html'>sitemap</a> |
<a href='feed.atom'>feed</a> |
<a href='../input/index.html'>home</a> |
<a href='../input/useful/index.html'>useful</a> |
<a href='../input/notes/index.html'>notes</a> |
<a href='../input/sitemap.html'>sitemap</a> |
<a href='../input/feed.atom'>feed</a> |
<a href='http://git.vern.cc/techn0path/'>git</a>
</nav><hr>