diff options
author | lupo49 <post@lupo49.de> | 2011-11-12 16:22:44 +0100 |
---|---|---|
committer | lupo49 <post@lupo49.de> | 2011-11-12 16:22:44 +0100 |
commit | fe9851b94f1bfe4014cf48043b4609def611a3ee (patch) | |
tree | 2362c48e0526f2254bb80a70db107b3032736a80 /_test | |
parent | 1614eb9180008daaf518e6271b82222219efc008 (diff) | |
parent | 2c961e6163b23ef3f1d93b1b0c23b214f3aeb358 (diff) | |
download | rpg-fe9851b94f1bfe4014cf48043b4609def611a3ee.tar.gz rpg-fe9851b94f1bfe4014cf48043b4609def611a3ee.tar.bz2 |
Merge remote branch 'upstream/master'
Diffstat (limited to '_test')
-rw-r--r-- | _test/cases/inc/auth_password.test.php | 3 | ||||
-rw-r--r-- | _test/cases/inc/pageutils_clean_id.test.php | 10 | ||||
-rw-r--r-- | _test/cases/inc/utf8_stripspecials.test.php | 1 | ||||
-rw-r--r-- | _test/jslint.js | 89 |
4 files changed, 101 insertions, 2 deletions
diff --git a/_test/cases/inc/auth_password.test.php b/_test/cases/inc/auth_password.test.php index 8646e3226..928552a14 100644 --- a/_test/cases/inc/auth_password.test.php +++ b/_test/cases/inc/auth_password.test.php @@ -43,8 +43,7 @@ class auth_password_test extends UnitTestCase { foreach($this->passes as $method => $hash){ $info = "testing method $method"; $this->signal('failinfo',$info); - - $hash = auth_cryptPassword('foo'.$method); + $hash = auth_cryptPassword('foo'.$method,$method); $this->assertTrue(auth_verifyPassword('foo'.$method,$hash)); } } diff --git a/_test/cases/inc/pageutils_clean_id.test.php b/_test/cases/inc/pageutils_clean_id.test.php index 01fa7dc1c..167229c7f 100644 --- a/_test/cases/inc/pageutils_clean_id.test.php +++ b/_test/cases/inc/pageutils_clean_id.test.php @@ -35,6 +35,16 @@ class init_clean_id_test extends UnitTestCase { $tests[] = array('ښ侧化并곦 β',false,'ښ侧化并곦_β'); $tests[] = array('page:page',false,'page:page'); $tests[] = array('page;page',false,'page:page'); + $tests[] = array('page:page 1.2',false,'page:page_1.2'); + + $tests[] = array('page._#!','false','page'); + $tests[] = array('._#!page','false','page'); + $tests[] = array('page._#!page','false','page._page'); + $tests[] = array('ns._#!:page','false','ns:page'); + $tests[] = array('ns:._#!page','false','ns:page'); + $tests[] = array('ns._#!ns:page','false','ns._ns:page'); + $tests[] = array('ns_:page',false,'ns:page'); + $tests[] = array('page...page','false','page...page'); $conf['useslash'] = 0; $tests[] = array('page/page',false,'page_page'); diff --git a/_test/cases/inc/utf8_stripspecials.test.php b/_test/cases/inc/utf8_stripspecials.test.php index 85df75fa1..481f47650 100644 --- a/_test/cases/inc/utf8_stripspecials.test.php +++ b/_test/cases/inc/utf8_stripspecials.test.php @@ -17,6 +17,7 @@ class utf8_stripspecials extends UnitTestCase { $tests[] = array('ascii.string','','\._\-:\*','asciistring'); $tests[] = array('ascii.string',' ','\._\-:\*','ascii string'); $tests[] = array('2.1.14',' ','\._\-:\*','2 1 14'); + $tests[] = array('string with nbsps','_','\*','string_with_nbsps'); foreach($tests as $test){ $this->assertEqual(utf8_stripspecials($test[0],$test[1],$test[2]),$test[3]); diff --git a/_test/jslint.js b/_test/jslint.js new file mode 100644 index 000000000..730f8d8a8 --- /dev/null +++ b/_test/jslint.js @@ -0,0 +1,89 @@ +/** + * Copy to a JavaScript console on your DokuWiki instance and execute + * Runs JSLint on all our JavaScript files with our settings + */ + +(function () { +var globals = ['jQuery', 'SIG', 'NS', 'JSINFO', 'LANG', 'DOKU_BASE', + 'DOKU_UHC' // FIXME: Should be moved to JSINFO + ], files = { + 'scripts/behaviour.js': null, + //"scripts/compatibility.js": null, + "scripts/cookie.js": null, + //"scripts/delay.js": null, + //"scripts/drag.js": null, + "scripts/edit.js": null, + "scripts/editor.js": null, + "scripts/helpers.js": null, + "scripts/hotkeys.js": null, + "scripts/index.js": null, + "scripts/linkwiz.js": null, + "scripts/locktimer.js": null, + "scripts/media.js": null, + "scripts/page.js": null, + "scripts/qsearch.js": null, + "scripts/script.js": null, + "scripts/textselection.js": null, + "scripts/toolbar.js": null, + "scripts/tree.js": null //, + //"scripts/tw-sack.js": null + }, overwrites = { + "scripts/script.js": {evil: true}, + "scripts/media.js": {devel: true, windows: true}, + "scripts/locktimer.js": {devel: true}, + "scripts/behaviour.js": {devel: true}, + "scripts/helpers.js": {windows: true} + }; + +jQuery.ajax({ + dataType: 'script', + type: "GET", +// url: 'http://jshint.com/jshint.js' + url: 'https://raw.github.com/douglascrockford/JSLint/master/jslint.js', + success: function () { + for (var file in files) { + jQuery.ajax({ + cache: false, + async: false, + type: "GET", + url: DOKU_BASE + 'lib/' + file, + dataType: 'text', + success: function (res) { + files[file] = res; + var data = lint(files[file]); + jQuery.merge(globals, data.globals); + }}); + } + + for (var file in files) { + if (!files[file]) { + continue; + } + // FIXME more fine-grained write access + var data = lint('/*global ' + globals.join(':true, ') + + ':true*/\n' + files[file], overwrites[file]); + console.log(file); + jQuery.each(data.errors || [], function (_, val) { + if (val === null) { + return; + } + console.error(val.reason + ' (Line ' + (val.line - 1) + + ', character ' + val.character + '):\n' + + val.evidence); + }); + }; + } +}); + +function lint(txt, overwrite) { + JSLINT(txt, jQuery.extend({ + // These settings are necessary + browser: true, + + // Things we probably should learn someday + sloppy: true, white: true, eqeq: true, nomen: true, + plusplus: true, regexp: true + }, overwrite)); + return JSLINT.data(); +} +})(); |