Skip to content
Permalink
Browse files

whack whack whack, more passing specs

  • Loading branch information
alex committed Jul 1, 2013
1 parent e463a74 commit 0e817a7de439aff36f9a8d19b1ff3ac632caea63
Showing with 29 additions and 6 deletions.
  1. +9 −0 spec/tags/core/io/each_line_tags.txt
  2. +9 −0 spec/tags/core/io/each_tags.txt
  3. +0 −3 topaz.mspec
  4. +11 −3 topaz/objects/stringobject.py
@@ -0,0 +1,9 @@
fails:IO#each_line with no separator yields each line to the passed block
fails:IO#each_line with no separator yields each line starting from the current position
fails:IO#each_line with no separator makes line count accessible via lineno
fails:IO#each_line with no separator makes line count accessible via $.
fails:IO#each_line with no separator returns an Enumerator when passed no block
fails:IO#each_line when passed a String containing one space as a separator uses the passed argument as the line separator
fails:IO#each_line when passed a String containing one space as a separator tries to convert the passed separator to a String using #to_str
fails:IO#each_line when passed an empty String as a separator yields each paragraph
fails:IO#each_line uses $/ as the default line separator
@@ -0,0 +1,9 @@
fails:IO#each with no separator yields each line to the passed block
fails:IO#each with no separator yields each line starting from the current position
fails:IO#each with no separator makes line count accessible via lineno
fails:IO#each with no separator makes line count accessible via $.
fails:IO#each with no separator returns an Enumerator when passed no block
fails:IO#each when passed a String containing one space as a separator uses the passed argument as the line separator
fails:IO#each when passed a String containing one space as a separator tries to convert the passed separator to a String using #to_str
fails:IO#each when passed an empty String as a separator yields each paragraph
fails:IO#each uses $/ as the default line separator
@@ -17,9 +17,6 @@ class MSpecScript
"^#{Rubyspec}/core/kernel/autoload_spec.rb",
"^#{Rubyspec}/core/filetest",
"^#{Rubyspec}/core/io/reopen_spec.rb",
"^#{Rubyspec}/core/io/each_spec.rb",
"^#{Rubyspec}/core/io/each_line_spec.rb",
"^#{Rubyspec}/core/io/foreach_spec.rb",
"^#{Rubyspec}/core/file/socket_spec.rb",
"^#{Rubyspec}/core/numeric/to_c_spec.rb",
"^#{Rubyspec}/core/process/status/exited_spec.rb",
@@ -667,9 +667,17 @@ def method_split(self, space, w_sep=None, limit=0):
return space.newarray(res_w)
elif space.is_kind_of(w_sep, space.w_string):
sep = space.str_w(w_sep)
return space.newarray([
space.newstr_fromstr(s) for s in split(space.str_w(self), sep, limit - 1)
])
if sep:
return space.newarray([
space.newstr_fromstr(s) for s in split(space.str_w(self), sep, limit - 1)
])
else:
if limit:
raise space.error(space.w_NotImplementedError, "String#split with empty string and limit")
return space.newarray([
space.newstr_fromstr(self.strategy.getitem(self.str_storage, i))
for i in xrange(self.length())
])
elif space.is_kind_of(w_sep, space.w_regexp):
results_w = []
n = 0

0 comments on commit 0e817a7

Please sign in to comment.
You can’t perform that action at this time.