From fa84eec5850ea5a648e406c375f35126b16979f6 Mon Sep 17 00:00:00 2001 From: Sam Sanders Date: Tue, 17 Jan 2012 14:25:05 +1300 Subject: [PATCH] [SIGNED-OFF] bug 5327 add tests for C4/ClassSortRoutine/LCC.pm Signed-off-by: Chris Cormack --- t/ClassSortRoutine_LCC.t | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/t/ClassSortRoutine_LCC.t b/t/ClassSortRoutine_LCC.t index 9a5e007..9aa2bde 100755 --- a/t/ClassSortRoutine_LCC.t +++ b/t/ClassSortRoutine_LCC.t @@ -6,9 +6,22 @@ use strict; use warnings; -use Test::More tests => 1; +use Test::More tests => 9; BEGIN { use_ok('C4::ClassSortRoutine::LCC'); } +#Obvious cases +is(C4::ClassSortRoutine::LCC::get_class_sort_key(), "", "No arguements returns an empty string"); +is(C4::ClassSortRoutine::LCC::get_class_sort_key('a','b'), "A_B", "Arguements 'a','b' return 'A_B'"); + +#spaces in arguements +is(C4::ClassSortRoutine::LCC::get_class_sort_key(' ','b'), "B_", "Arguements ' ','b' return 'B_'"); +is(C4::ClassSortRoutine::LCC::get_class_sort_key('a',' '), "A_", "Arguements 'a',' ' return 'A_'"); +is(C4::ClassSortRoutine::LCC::get_class_sort_key(' ',' '), "", "Arguements ' ',' ' return ''"); + +#'funky cases' based on regex in code +is(C4::ClassSortRoutine::LCC::get_class_sort_key('.','b'), "_B", "Arguements '.','b' return '_B'"); +is(C4::ClassSortRoutine::LCC::get_class_sort_key('....','........'), "_______", "Arguements '....','........' return '_______'"); +is(C4::ClassSortRoutine::LCC::get_class_sort_key('.','.'), "__", "Arguements '.','.' return '__'"); -- 1.7.5.4