natalie-lang / natalie

a work-in-progress Ruby compiler, written in Ruby and C++
https://natalie-lang.org
MIT License
931 stars 61 forks source link

Mass spec refresh #2174

Closed herwinw closed 2 months ago

herwinw commented 2 months ago

I used a script to find all fully passing upstream specs and copy them from a local checkout.

herwinw commented 2 months ago

For future reference: I hacked this together:

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'json'

spec = JSON.load_file('current.json')['stats']['spec']

walk_spec = lambda do |part|
  part.flat_map do |key, value|
    if value.key?('compiled')
      if value['compiled'] && !value['crashed'] && value['errors'].zero? && value['failures'].zero? && value['success'].positive? && !value['timeouted']
        [key]
      else
        []
      end
    else
      result = walk_spec.call(value)
      if result.empty?
        []
      else
        result.map { |rest| "#{key}/#{rest}" }
      end
    end
  end
end

passing = walk_spec.call(spec)
passing.each do |file|
  `cp ../ruby-spec/#{file} spec/#{file}`
end
herwinw commented 2 months ago

This one includes some changes likes:

-  # NATFIXME: Inconsistent results. We can probably fix this once we implement IO#close_read
-  xit "raises IOError on stream not opened for reading" do
+  it "raises IOError on stream not opened for reading" do
     -> { STDOUT.ungetbyte(42) }.should raise_error(IOError, "not opened for reading")
   end

So I probably need to get through all of them before I feel comfortable merging this.

herwinw commented 2 months ago

Additional updates:

seven1m commented 2 months ago

Sweet.