JE

 view release on metacpan or  search on metacpan

t/15.05-string-objects.t  view on Meta::CPAN

}()

// 21 tests
ok('foo'.slice() === 'foo', 'slice without args')
is('foo'.slice(undefined), 'foo','slice(undefined)')
is('foo'.slice(null),'foo','slice(null)')
is('foo'.slice(true),'oo','slice(bool)')
is('foo'.slice('2'),'o','slice(str)')
is('foo'.slice({}),'foo','slice(obj)')
is('foo'.slice(1.7),'oo','slice(fraction)')
is('foo'.slice(1,void 0),'oo','slice with undefined endpoint')
is('foo'.slice(1,null),'','slice with null endpoint')
is('foo'.slice(1,'2'),'o','slice with string endpoint')
is('foo'.slice(0,{}),'','slice with objectionable endpoint')
is('foo'.slice(0,true),'f','slice with boolean endpoint')
is('bar'.slice(-1,3),'r','slice with negative start')
is('bar'.slice(0,-1),'ba','slice with negative endpoint')
is('bar'.slice(-2,-1),'a','slice with two negs')
is('bar'.slice(0,2),'ba','slice with two positives')
is('bar'.slice(-7,2),'ba',
	'slice w/negative start reaching beyond the start of the string')
is('bar'.slice(0,-20),'',
	'slice w/negative end reaching beyond the start of the string')
is('bar'.slice(78,79),'', 'slice with start > length')
is('bar'.slice(1,79),'ar','slice with end > length')
is('bar'.slice(2,1),'','slice with positive end > positive start')

t/15.05-string-objects.t  view on Meta::CPAN

}()

// 19 tests
ok('foo'.substring() === 'foo', 'substring without args')
is('foo'.substring(undefined), 'foo','substring(undefined)')
is('foo'.substring(null),'foo','substring(null)')
is('foo'.substring(true),'oo','substring(bool)')
is('foo'.substring('2'),'o','substring(str)')
is('foo'.substring({}),'foo','substring(obj)')
is('foo'.substring(1.7),'oo','substring(fraction)')
is('foo'.substring(1,void 0),'oo','substring with undefined endpoint')
is('foo'.substring(1,null),'f','substring with null endpoint')
is('foo'.substring(1,'2'),'o','substring with string endpoint')
is('foo'.substring(0,{}),'','substring with objectionable endpoint')
is('foo'.substring(0,true),'f','substring with boolean endpoint')
is('bar'.substring(-1,3),'bar','substring with negative start')
is('bar'.substring(0,-1),'','substring with negative endpoint')
is('bar'.substring(-2,-1),'','substring with two negs')
is('bar'.substring(0,2),'ba','substring with two positives')
is('bar'.substring(78,79),'', 'substring with start > length')
is('bar'.substring(1,79),'ar','substring with end > length')
is('bar'.substring(2,1),'a','substring with positive end > positive start')


// ===================================================
// 15.5.4.16: toLowerCase
// ===================================================



( run in 1.869 second using v1.01-cache-2.11-cpan-524268b4103 )