Skip to content

Commit

Permalink
[Truffle] Add argf to core
Browse files Browse the repository at this point in the history
  • Loading branch information
bjfish committed May 17, 2015
1 parent 34dd04d commit af179e5
Show file tree
Hide file tree
Showing 17 changed files with 563 additions and 30 deletions.
1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/argf_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/argf/binmode_tags.txt
@@ -1,5 +1,3 @@
fails:ARGF.binmode returns self
fails:ARGF.binmode does not raise an error
fails:ARGF.binmode sets the file's encoding to ASCII-8BIT
fails:ARGF.binmode puts reading into binmode
fails:ARGF.binmode puts alls subsequent stream reading through ARGF into binmode
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/argf/codepoints_tags.txt
@@ -1,5 +1,2 @@
fails:ARGF.codepoints is a public method
fails:ARGF.codepoints does not require arguments
fails:ARGF.codepoints returns self when passed a block
fails:ARGF.codepoints returns an Enumerator when passed no block
fails:ARGF.codepoints yields each codepoint of all streams
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/argf/each_codepoint_tags.txt
@@ -1,5 +1,2 @@
fails:ARGF.each_codepoint is a public method
fails:ARGF.each_codepoint does not require arguments
fails:ARGF.each_codepoint returns self when passed a block
fails:ARGF.each_codepoint returns an Enumerator when passed no block
fails:ARGF.each_codepoint yields each codepoint of all streams
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/argf/each_line_tags.txt
@@ -1,6 +1,3 @@
fails:ARGF.each_line is a public method
fails:ARGF.each_line requires multiple arguments
fails:ARGF.each_line reads each line of files
fails:ARGF.each_line returns self when passed a block
fails:ARGF.each_line returns an Enumerator when passed no block
fails:ARGF.each_line with a separator yields each separated section of all streams
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/argf/each_tags.txt
@@ -1,6 +1,3 @@
fails:ARGF.each is a public method
fails:ARGF.each requires multiple arguments
fails:ARGF.each reads each line of files
fails:ARGF.each returns self when passed a block
fails:ARGF.each returns an Enumerator when passed no block
fails:ARGF.each with a separator yields each separated section of all streams
1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/gets_tags.txt
@@ -1,6 +1,5 @@
fails:ARGF.gets reads one line of a file
fails:ARGF.gets reads all lines of a file
fails:ARGF.gets reads all lines of stdin
fails:ARGF.gets reads all lines of two files
fails:ARGF.gets sets $_ global variable with each line read
fails:ARGF.gets modifies the files when in place edit mode is on
Expand Down
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/argf/lines_tags.txt
@@ -1,6 +1,3 @@
fails:ARGF.lines is a public method
fails:ARGF.lines requires multiple arguments
fails:ARGF.lines reads each line of files
fails:ARGF.lines returns self when passed a block
fails:ARGF.lines returns an Enumerator when passed no block
fails:ARGF.lines with a separator yields each separated section of all streams
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/argf/read_tags.txt
Expand Up @@ -7,9 +7,6 @@ fails:ARGF.read reads from a single file consecutively
fails:ARGF.read reads the contents of two files
fails:ARGF.read reads the contents of one file and some characters from the second
fails:ARGF.read reads across two files consecutively
fails:ARGF.read reads the contents of stdin
fails:ARGF.read reads a number of bytes from stdin
fails:ARGF.read reads the contents of one file and stdin
fails:ARGF.read reads the contents of the same file twice
fails:ARGF.read reads the contents of a special device file
fails:ARGF.read reads the contents of the file with default encoding
1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/readline_tags.txt
@@ -1,6 +1,5 @@
fails:ARGF.readline reads one line of a file
fails:ARGF.readline reads all lines of a file
fails:ARGF.readline reads all lines of stdin
fails:ARGF.readline reads all lines of two files
fails:ARGF.readline sets $_ global variable with each line read
fails:ARGF.readline modifies the files when in place edit mode is on
Expand Down
1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/seek_tags.txt
@@ -1,4 +1,3 @@
fails:ARGF.seek sets the absolute position relative to beginning of file
fails:ARGF.seek sets the position relative to current position in file
fails:ARGF.seek sets the absolute position relative to end of file
fails:ARGF.seek takes at least one argument (offset)
1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/skip_tags.txt
@@ -1,4 +1,3 @@
fails:ARGF.skip skips the current file
fails:ARGF.skip has no effect when called twice in a row
fails:ARGF.skip has no effect at end of stream
fails:ARGF.skip has no effect when the current file is the last
1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/to_s_tags.txt

This file was deleted.

5 changes: 4 additions & 1 deletion spec/truffle/truffle.mspec
Expand Up @@ -51,7 +51,10 @@ class MSpecScript
# "^spec/ruby/core/string/gsub_spec.rb",

# require etc, linux only spec
"^spec/ruby/core/io/advise_spec.rb"
"^spec/ruby/core/io/advise_spec.rb",

# Pollutes other tests
"^spec/ruby/core/argf/binmode_spec.rb"
]

core += [
Expand Down
2 changes: 1 addition & 1 deletion truffle/src/main/ruby/core.rb
Expand Up @@ -109,7 +109,7 @@
require_relative 'core/rubinius/common/proc'
require_relative 'core/rubinius/common/enumerable'
require_relative 'core/rubinius/common/enumerator'
#require_relative 'core/rubinius/common/argf'
require_relative 'core/rubinius/common/argf'
#require_relative 'core/rubinius/common/tuple'
require_relative 'core/rubinius/common/exception'
require_relative 'core/rubinius/common/undefined'
Expand Down

3 comments on commit af179e5

@chrisseaton
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this passes some of the specs - do you know if the basic functionality actually works though?

@bjfish
Copy link
Contributor Author

@bjfish bjfish commented on af179e5 May 17, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisseaton It looks like some basic functionality is working, here are 3 examples:

Read stdin:

$ echo "My string" | ~/Documents/jruby/bin/jruby -X+T -e 'p ARGF.read'
"My string\n"

Read args:

File argf.rb:

puts ARGV.to_s
~/Documents/jruby/bin/jruby -X+T argf.rb --verbose file1 file2
["--verbose", "file1", "file2"]

Read file:

File argf2.rb:

  ARGF.each do |arg|
    puts arg
  end
~/Documents/jruby/bin/jruby -X+T argf2.rb argf2.rb 
ARGF.each do |arg|
  puts arg
end

@eregon
Copy link
Member

@eregon eregon commented on af179e5 May 17, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice Quine for the third one!

Please sign in to comment.