Commit Graph

63 Commits

Author SHA1 Message Date
Alex Schroeder
1bc670617e test.pl: move to encode_utf8 as well 2016-06-22 14:54:52 +02:00
Alex Schroeder
f2f464b1ca test.pl: no warning about killing the server 2016-06-15 10:32:58 +02:00
Alex Schroeder
cb00e7e969 Prevent warning by using 127.0.0.1
Using localhost leads to a warning on my Debian Wheezy system.
2016-06-12 22:29:49 +02:00
Alex Schroeder
8e73f6f0dd Use /wiki in $ScriptName for Mojolicious test 2016-06-12 21:26:18 +02:00
Alex Schroeder
196b960b47 Add test for Mojolicious server 2016-06-12 17:32:20 +02:00
Alex Schroeder
241a88ef48 Move server starting code from atom.t to test.pl 2016-06-11 20:08:04 +02:00
Alex Schroeder
6372907c4b Parallelize tests
Using random numbers to generate new test-directories for every test
file. Use t/setup.pl to reset.
2015-10-12 15:13:22 +02:00
Aleks-Daniel Jakimenko
3b6d891dc7 Stop leaving locks behind
Previously if some user cancelled his request (simply by pressing Stop button
in his browser), then the script will receive a TERM signal or the like.

This means that some locks could be left behind, which required someone
to unlock the wiki manually (by using Unlock Wiki action).

Now we remove these locks automatically!

However, some tasks might want to handle such situations gracefully. That's why
%LockCleaners hash was added. Use lock name as the key and put a coderef as a
value. If SIGTERM (or a bunch of other signals) is received, then it will run
this code, which, supposedly, cleans all of the stuff after it. Private Wiki
Extension was changed according to that, so you can see it in action.

Also, tests added!
2015-09-23 21:07:02 +03:00
Alex Schroeder
9472a279ea Lots of tests for preview pagination 2015-09-12 00:05:30 +02:00
Alex Schroeder
2ca2d43068 test.pl: run_tests_negative and xpath variant
run_tests_negative and xpath_run_tests_negative are new. They
encapsulate the call to apply_rules.
2015-07-13 08:46:50 +02:00
Alex Schroeder
ff069557f5 test.pl: Fix setup for Darwin OS. 2015-07-05 08:42:10 +02:00
Aleks-Daniel Jakimenko
4689452d8e Removing clear_pages() from the beginning of tests (part 4, final)
Added clear_pages() before Init(). All tests pass without significant problems.

rollback.t is still confusing:
WriteStringToFile($RcFile, "1 FirstPage 1 \n");
AppendStringToFile($RcFile, "2 SecondPage 1 \n");
clear_pages();

What's the point of writing to rc file if we delete that immediately?

Besides that, everything is OK!
2015-07-05 03:58:39 +03:00
Aleks-Daniel Jakimenko
9f636bd021 Correct shell quoting 2015-06-27 14:45:48 +03:00
Alex Schroeder
2e91d5a722 test.pl: use '$DataDir' in shell commands
I ran some tests using a RAM Disk, so I set $DataDir to a directory
containing a space in its name. This broke clean_pages.
2015-06-26 20:12:40 +02:00
Aleks-Daniel Jakimenko
b823d373b0 test.pl: UTF-8 instead of utf8 (attempt to tests - nope) 2015-05-02 05:18:09 +03:00
Alex Schroeder
bc4c26f26c test.pl: fix typo 2015-04-24 08:47:03 +02:00
Alex Schroeder
0b5ccf0bb3 t/test.pl xpath functions now return lists
xpath_do now returns a list of results if you're calling it in list
context. This will work, for example:

my ($ts, $title, $text) = xpath_test($page,
				     '//input[@name="oldtime"]/attribute::value',
				     '//input[@name="title"]/attribute::value',
				     '//textarea[@name="text"]/text()');
2015-04-02 21:46:49 +02:00
Alex Jakimenko
f4e551111a Executable flag is only useful when shebang is specified 2014-09-03 14:23:20 +03:00
Alex Schroeder
0d592e12f2 test.pl: extract config file writing
Move the writing of the config file (and the resetting of the important
variables) into a separate file so that tests can reset the config file
without clearing all the pages.
2014-07-31 13:17:02 +02:00
Alex Schroeder
365d33b602 Get rid of one letter sub-directories.
Recent GNU/Linux systems use ext3 or ext4 file systems. These use HTree
to index files. Wikipedia says: "HTree indexing improved the scalability
of Linux ext2 based filesystems from a practical limit of a few thousand
files, into the range of tens of millions of files per directory. [...]
HTree indexes are available in ext3 when the dir_index feature is
enabled. [...] HTree indexes are turned on by default in ext4."

Thus, instead of working on balanced-page-directories.pl, we decided to
get rid of these sub-directories altogether.

Unfortunately, this is backwards incompatible. Users wanting to upgrade
will need to install the upgrade.pl extension in order to upgrade the
file database.
2014-06-06 17:32:44 +02:00
Alex Schroeder
45a0558fcc Fixing the UTF-8 encoding issues for static export 2014-03-18 11:49:28 +01:00
Alex Schroeder
0d7236c047 More tests regarding local links in static exports 2014-03-18 10:32:22 +01:00
Alex Schroeder
ad1059dbb2 Revert the last commit.
The output has to be encoded as well.
2014-01-25 18:16:06 +01:00
Alex Schroeder
6d457ff87b Fix newline handling. 2014-01-24 23:19:37 +01:00
Alex Schroeder
d864045815 Use $PERLBREW_PATH if available.
Try to guess which Perl we should be using. Since we loaded wiki.pl,
our $ENV{PATH} is set to /bin:/usr/bin in order to find diff and grep.
Prepending /usr/local/bin is one option, using $PERLBREW_PATH is
another.
2013-08-21 10:41:51 +02:00
Alex Schroeder
8e72af0a45 Fix encoding issues with the use of DB_File in mail.pl.
This also fixes the tests. Also get rid of wide character in print by
Test::Builder by adding the fix mentioned in the Test::More manpage.

The DB_File issue was necessary because a page name with an EN DASH
caused the script to crash, thus not printing the footer.
Unfortunately, this is solved by URL-encoding keys and values. This
means that your old mail.db is going to be invalid!
2013-01-12 23:55:08 +01:00
Alex Schroeder
f08a404bde clear_page unsets @IndexList
Without this, running t/tags.t will alternate between running ok and
producing an error: "Cannot open test-data/page/I/InterMap.pg: No such
file or directory"
2012-08-05 02:28:39 +02:00
Alex Schroeder
3ab606d96a Fixed UTF-8 support in various automated tests.
Issues:

- the Mac layer was masking issues because of the NFC/NFD difference and existing compatiblity hacks in mac.pl
- drafts.pl was suffering from a double encoding issue
- crossbar.t and download.t tests were failing because I had recently fixed DoDownload output to be raw instead of encoded
- test.pl now has a way to capture the raw, unencoded output produced by DoDownload
- tags.t got some tests to prove that recent changes to wiki.pl actually work
2012-07-30 23:30:27 +02:00
Alex Schroeder
6e5766f431 On some encoding problems
The TOC extension causes problems when including non-ASCII Text.
2012-07-04 21:36:56 +02:00
Alex Schroeder
3174e184f9 Fix an encoding error in namespaces.pl on Debian
The Debian installation uses ext3 and therefore raw bytes for
filenames unlike the HFS filesystem of Mac OSX.

Copyright years were updated. The maintenance output of for drafts was
cleaned up.
2012-05-25 01:00:10 +02:00
Alex Schroeder
67650e3dc8 More UTF-8 fixes
All the source files containing non-ASCII characters needed to have
utf8 added. This will be necessary for user config files as well! The
regular expressions identifying page names had to be changed.
UrlEncode translates the string back to bytes before encoding it.
Cached RSS files are saved with UTF-8 encoding and therefore need
their meta-data changed (using the XML::RSS module to do this
correctly didn't work for some of the test files). The CGI object's
parameters, keywords and info_path are decoded correctly. File access
uses the UTF-8 layer (reading, writing, appending, access to the log
of recent changes, running sub processes with grep and diff).

The mac compatibility extension will also disable the use of grep if
non-ASCII characters are searched for because of an unexplained
problem with grep.
2012-05-24 18:08:42 +02:00
Alex Schroeder
cd2b4d624e Remove $HttpCharset and moved everything to UTF-8
This also required some changes to the tests where explicit UTF-8
encoding had been used in the past.
2012-05-22 11:50:23 +02:00
Alex Schroeder
c1ea66fb8a Revert last change. 2010-11-07 02:03:15 +00:00
Alex Schroeder
750c45b88c (update_page): Make sure we don't add an url-encoded pagename to the
IndexHash.
2010-11-06 16:19:19 +00:00
Alex Schroeder
dbfaa13475 *** empty log message *** 2009-08-31 08:33:12 +00:00
Alex Schroeder
28d074382f (clear_pages, add_module): Add code to make it work on
Windows with Cygwin.
2008-12-17 12:36:52 +00:00
Alex Schroeder
9771b04adc (xpath_do): Strip XML preprocessing instruction and
call the XML parser if the HTML parser fails. Now we can write
XPath tests on XML documents.
2008-10-12 21:21:12 +00:00
Alex Schroeder
d4bfcb05a2 (name): Show the last 60 characters of a XPath test
instead of the first 60 as this makes them easier to find.
2008-10-04 11:10:18 +00:00
Alex Schroeder
023791c188 (xpath_do): No longer strip the HTML element in order
to allow tests for meta data.
2008-06-13 14:41:13 +00:00
Alex Schroeder
bd7bc703a2 Get rid of $resultfile. 2008-06-11 11:03:21 +00:00
Alex Schroeder
f3ecf7e59e Switch from /tmp/oddmuse to $DataDir. 2008-05-26 22:58:39 +00:00
Alex Schroeder
ccaef32818 Revert change to $DataDir. 2008-03-08 00:41:51 +00:00
Alex Schroeder
752de2c7a2 Set $DataDir and $ENV{WikiDataDir} to '/tmp/oddmuse'. 2008-03-08 00:17:54 +00:00
Alex Schroeder
c65d1b8274 (xpath_do): Don't be confused by the new xmlns
attribute in the html element.
2007-11-13 20:21:10 +00:00
Alex Schroeder
7abb16ecec (xpath_do): Only print the page once per test run. 2007-10-10 14:37:04 +00:00
Alex Schroeder
972a63fc40 (update_page): Pass $rest to the output command as
well, because of the ns parameter when testing namespaces.
2006-12-22 15:38:06 +00:00
Alex Schroeder
3532774939 Check $redirect instead of $output for Status 302! 2006-10-10 01:37:01 +00:00
Alex Schroeder
92464f3217 (update_page): Add $id to the hash only if there was no error creating
or updating the page.
2006-10-10 01:28:17 +00:00
Alex Schroeder
58e4172bbc Convert to Unix EOL.
Fix the reinitialization after the creation of InterMap pages.
2006-10-10 01:17:23 +00:00
Alex Schroeder
44dfd00ff2 (test_page_negative, xpath_do): Print a "not" prefix
for negative tests.
2006-10-06 12:13:18 +00:00