summaryrefslogtreecommitdiff
path: root/t/inc/Title.t
blob: 7373b9f23f4cdab8887fd7b9e698967eee180656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env php
<?php

require 't/Test.php';

plan( 2 + 255 );

require_ok( 'includes/Defines.php' );

# require_ok() doesn't work for these, find out why
define( 'MEDIAWIKI', 1 );
require 'LocalSettings.php';
require 'includes/DefaultSettings.php';

require_ok( 'includes/Title.php' );

#
# legalChars()
#

$titlechars = Title::legalChars();

foreach ( range( 1, 255 ) as $num ) {
	$chr = chr( $num );
	if ( strpos( "#[]{}<>|", $chr ) !== false || preg_match( "/[\\x00-\\x1f\\x7f]/", $chr ) ) {
		unlike( $chr, "/[$titlechars]/", "chr($num) = $chr is not a valid titlechar" );
	} else {
		like(   $chr, "/[$titlechars]/", "chr($num) = $chr is a valid titlechar" );
	}
}

/* vim: set filetype=php: */