[Lxr-commits] CVS: lxr-tools/tests SecurityTest.pm,1.2,1.3
Brought to you by:
ajlittoz
From: Malcolm B. <mb...@us...> - 2010-01-05 17:58:38
|
Update of /cvsroot/lxr/lxr-tools/tests In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv9175 Modified Files: SecurityTest.pm Log Message: Add tests for problem with clean_identifier Index: SecurityTest.pm =================================================================== RCS file: /cvsroot/lxr/lxr-tools/tests/SecurityTest.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SecurityTest.pm 10 May 2009 11:54:33 -0000 1.2 +++ SecurityTest.pm 5 Jan 2010 17:58:27 -0000 1.3 @@ -102,6 +102,20 @@ } +sub test_clean_identifier { + # Test that LXR::Common::clean_identifier does a good job + my $self = shift; + my @good_ids = ("i", "warning", "malcolm.box", "g`b", "aZX091-12-12", "ax_box", "AaX09-_.:`"); + my %bad_ids = ( "<script>", "script"); + my $i; + foreach $i (@good_ids) { + $self->assert($i eq LXR::Common::clean_identifier($i), "clean_identifier changed $i"); + } + foreach $i (keys(%bad_ids)) { + $self->assert($bad_ids{$i} eq LXR::Common::clean_identifier($i), "clean_identifier didn't clean $i") + } +} + sub test_filename_wash { # Check that filenames are washed my $self = shift; |