Sha256: 62729d89cad79c3e31b9ecea0a54139954c287f3f43fbe6b84d5f90c61c54300
Contents?: true
Size: 717 Bytes
Versions: 10
Compression:
Stored size: 717 Bytes
Contents
# Copied from cruby and modified to skip unsupported syntaxes require 'test/unit' require 'nodejs' require 'nodejs/file' class TestNodejsFile < Test::Unit::TestCase def test_write_read path = "/tmp/testing_nodejs_file_implementation_#{Time.now.to_i}" contents = 'foobar' assert !File.exist?(path) File.write path, contents assert_equal(contents, File.read(path)) end def test_read_file File.write('tmp/foo', 'bar') assert_equal("bar", File.read('tmp/foo')) end def test_read_each_line File.write('tmp/bar', "one\ntwo") file = File.new('tmp/bar', 'r') lines = [] file.each_line do |line| lines << line end assert_equal(lines.length, 2) end end
Version data entries
10 entries across 10 versions & 1 rubygems