AgeCommit message (Collapse)AuthorLines
Show a full index page for a negative offsetBryce Kwon-0/+18
The query parser takes an offset as low as -1, which the stats page reads as every author, so the index clamps it for itself, as the log and refs pages already do.
Move the root-readme test to the index testsBryce Kwon-0/+12
The test reads the index and the site about page, both drawn by ui-repolist.c. Its site had no repositories, so the index it read was the error page, and a readme printed below the list went unseen. The shared repositories give it a real index.
Add a helper for configs of several repositoriesBryce Kwon-49/+22
The configs a run of t0101 writes are byte for byte what they were. The scan configs name no repository and descrc adds one to a copy of the shared config, so those keep their own form.
Test the index sections and their orderingBryce Kwon-0/+65
Nothing tested section, section-sort or repository-sort, nor the heading's colspan, which BASE_COLUMNS has to keep in step with the headings by hand.
Copy the shared config for the cut descriptionBryce Kwon-3/+2
It repeated the sed that cgitrc_copy runs, only to add a repository after the copy.
Test a description limit of zero or lessBryce Kwon-0/+9
Test an empty search under a url prefixBryce Kwon-0/+17
Only a prefix holding no repository and a search of the whole index were tested, so the check that tells the two messages apart could go unnoticed.
Check the index search and sort see descriptionsBryce Kwon-0/+12
The test looked only at the rows, which show the file's text wherever it is read, so moving the read below the search or the sort passed.
Check the order of every index sort columnBryce Kwon-10/+51
Only the name sort had its order checked. For the other columns the test looked for one repository on the page, and the shared fixture could not show an order anyway, since no repository there has an owner and their ref times tie. Nothing read an age file either, though the idle column takes its date from one first.
Hold the index tests to a working pageBryce Kwon-17/+23
The index requests passed on any answer short of a crash. The checks for the missing tree and log links read a page an earlier test wrote, so run alone they passed with no page at all. The description and summary link checks matched their text anywhere on the page rather than in foo's row.
Say which index column is sortedBryce Kwon-0/+13
Say when nothing matches a mistyped urlBryce Kwon-0/+11
Read the description file without repo.descBryce Kwon-0/+26
Only a scanned repository fell back to its description file, so one listed in cgitrc without repo.desc showed "[no description]" however its file read. repo.desc may follow repo.path, so the file is read where a page shows the description, which also spares every other request the reads.
List scanned repositories in path orderBryce Kwon-0/+27
readdir hands entries back in whatever order the filesystem keeps them, so proj111 could come before proj105 and a section could start twice. section-sort is off by default to keep the order written in cgitrc, and a scan has none to keep.
Move the feed link check in with the feed testsBryce Kwon-6/+0
It asks for a log page, and the index never carries a feed link.
Add the shared config writers and cgit_rcBryce Kwon-14/+6
The helpers are named by kind. cgitrc_repo and cgitrc_copy write the config file named first, and cgit_url, cgit_query and cgit_rc run cgit, each named after what it is handed first. A repository copies its defaults from the globals read before its repo.url, so cgitrc_repo places every setting itself, and a global can no longer land where it silently stops applying. The t00xx and t01xx files move to them here.
Tighten the checks that match stray textBryce Kwon-2/+2
Every page holds foo in its footer element, the foo+bar row holds bar, the branch switcher holds master, and commit 1 and file-1 also match commits 10 to 19 and file-10 to file-19. A search page repeats its term in the search box. So these checks passed on pages that lacked what they look for, and each now matches the link itself.
Test the features the suite never reachedBryce Kwon-0/+13
Index sorting, the commit graph, the stats periods past a week, the hex dump of a binary file and a Lua filter's html_url_arg and html_include ran in no test.
Cut text between characters, never inside oneBryce Kwon-0/+14
The index description was cut at a byte count, which could split a multibyte character and leave an invalid sequence on the page. Commit subjects already backed up to the start of the character, so html_ntxt now does that for every caller.
Encode repository urls and the feed branchBryce Kwon-2/+8
Links built from the repository url, among them the description link on the index and the Atom and refs links, wrote it as configured, so a name holding a space, '#' or '?' broke them. The feed link in the page head did the same with the branch, which turned a '+' into a space.
Say that js may be given more than onceBryce Kwon-1/+20
Name the log link that enable-index-links addsBryce Kwon-1/+10
The manual has named the commit page since it was written in 2008, a year after the index started linking the log instead.
Trim the comments and dead code across the treeBryce Kwon-6/+4
Tidy the test comments and shell portabilityBryce Kwon-0/+7
tests: use Git's test frameworkJohn Keeping-13/+12
This allows tests to run in parallel as well as letting us use "prove" or another TAP harness to run the tests. Git's test framework requires Git to be fully built before letting any tests run, so add a new target to the top-level Makefile which builds all of Git instead of just libgit.a and make the "test" target depend on that. Signed-off-by: John Keeping <john@keeping.me.uk>
tests: "grep -e" is not portable to all platformsJohn Keeping-9/+9
The "-e" option to grep is not needed unless specifying more than one pattern, which we don't do. Remove it to avoid restricting the tests on platforms that do not have a grep that recognises "-e". Signed-off-by: John Keeping <john@keeping.me.uk>
tests: add tests for links with space in path and/or argsLars Hjemli-0/+1
These tests tries to detect bad links in various pages. On the log page, there currently exists links which are not properly escaped due to the use of cgit_fileurl() when building the link. For now, this bug is simply tagged as such. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
ui-shared.c: use html_url_arg()Lars Hjemli-0/+2
The link-generating functions are updated to use the new html_url_arg function, thereby fixing links to strange repos, branches and files. Also, the test-suite is updated to verify some cases of strange urls. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Brown paper bag: don't use `grep -v`Lars Hjemli-2/+2
For some inexplicable reason I'd gotten the semantics of `grep -v` totally backwards, thinking it somehow would make the exitcode from grep indicate the non-match of the specified pattern. This fixes the broken tests and gives me a valuable lession about shell programming at the same time. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Add regression-test for description-less reposLars Hjemli-0/+2
The segfault fixed in commit eacde43d7184452e1fdc90b982b531f1f5239923 was triggered when the html-functions manipulated string literals. One callpatch which could trigger the bug is in ui-repolist.c when repo descriptions are passed to html_ntxt(): if a repo is lacking a description, the literal string "[no description]" is used. This patch changes test/setup.sh such that the first repo has no description, and adds tests for both "[no description]" and "the bar repo" (description of the other repo) to tests/t0101-index.sh, which should be enought to catch regressions in these functions. Noticed-by: Hiroki Hattori <seagull.kamome@gmail.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Create initial testsuiteLars Hjemli-0/+13
This creates a simple testsuite, heavily inspired by the testsuite in git. Signed-off-by: Lars Hjemli <hjemli@gmail.com>