def testIfsSplitEmpty(self): self.assertEqual([''], word_eval._IfsSplit('', ' \t\n')) self.assertEqual(['', ''], word_eval._IfsSplit(' ', ' \t\n')) self.assertEqual([''], word_eval._IfsSplit('', ' ')) # No word splitting when no IFS. Hm. self.assertEqual([''], word_eval._IfsSplit('', ''))
def testIfsSplit(self): self.assertEqual(['', 'foo', 'bar', ''], word_eval._IfsSplit('\tfoo bar\n', ' \t\n')) self.assertEqual(['\tfoo bar\n'], word_eval._IfsSplit('\tfoo bar\n', '')) self.assertEqual(['a', '', 'd'], word_eval._IfsSplit('abcd', 'bc'))
def testIfsSplit(self): self.assertEqual( ['foo', 'bar'], word_eval._IfsSplit('\tfoo bar\n', ' \t\n')) self.assertEqual( ['\tfoo bar\n'], word_eval._IfsSplit('\tfoo bar\n', '')) self.assertEqual( ['a', '', 'd'], word_eval._IfsSplit('abcd', 'bc')) self.assertEqual( ['a', 'cd'], word_eval._IfsSplit('abcd', ' b')) # IFS whitespace rule self.assertEqual( ['a', 'c'], word_eval._IfsSplit('abc', 'b ')) self.assertEqual( ['a', 'c'], word_eval._IfsSplit('a c', 'b ')) self.assertEqual( ['a', '', 'c'], word_eval._IfsSplit('abbc', 'b ')) self.assertEqual( ['a', '', '', 'cd'], word_eval._IfsSplit('\ta b\tb cd\n', 'b \t\n')) self.assertEqual( ['a', 'cd'], word_eval._IfsSplit('\tabcd\n', 'b \t\n')) # No non-whitespace IFS self.assertEqual( ['a', 'c'], word_eval._IfsSplit(' a c ', ' '))
def testIfsSplit_Mixed(self): self.assertEqual(['a', 'cd'], word_eval._IfsSplit('abcd', ' b')) # IFS whitespace rule self.assertEqual(['a', 'c'], word_eval._IfsSplit('abc', 'b ')) self.assertEqual(['a', 'c'], word_eval._IfsSplit('a c', 'b ')) self.assertEqual(['a', '', 'c'], word_eval._IfsSplit('abbc', 'b ')) self.assertEqual(['', 'a', '', '', 'cd', ''], word_eval._IfsSplit('\ta b\tb cd\n', 'b \t\n')) self.assertEqual(['', 'a', 'cd', ''], word_eval._IfsSplit('\tabcd\n', 'b \t\n'))
def testIfsSplitNonWhitespaceOnly(self): self.assertEqual(['a', 'c'], word_eval._IfsSplit('a_c', '_')) self.assertEqual(['', ''], word_eval._IfsSplit('_', '_'))
def testIfsSplitWhitespaceOnly(self): # No non-whitespace IFS self.assertEqual(['', 'a', 'c', ''], word_eval._IfsSplit(' a c ', ' ')) self.assertEqual(['', 'c'], word_eval._IfsSplit(' c', ' \t\n'))
def testIfsSplit_Mixed2(self): # Doesn't work yet return self.assertEqual(['a', '', '', 'b'], word_eval._IfsSplit('a _ _ _ b', '_ '))