Runtime assertions for Ruby literal.fun
ruby
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Empty properties tests actually passing (#118)

* Empty properties tests actually passing

Signed-off-by: Samuel Giddins <segiddins@segiddins.me>

* Update Gemfile.lock

* Tests passing on ruby 3.1

That is the oldest ruby that is not EOL

Signed-off-by: Samuel Giddins <segiddins@segiddins.me>

* Compatible gems in lockfile

---------

Signed-off-by: Samuel Giddins <segiddins@segiddins.me>

authored by

Samuel Giddins and committed by
GitHub
3c712efb 3b436f6d

+62 -19
+9 -1
.github/workflows/ruby.yml
··· 10 10 contents: read 11 11 12 12 jobs: 13 + ruby-versions: 14 + uses: ruby/actions/.github/workflows/ruby_versions.yml@3fbf038d6f0d8043b914f923764c61bc2a114a77 15 + with: 16 + engine: all 17 + min_version: 3.1 18 + 13 19 test: 20 + needs: ruby-versions 14 21 runs-on: ubuntu-latest 15 22 strategy: 23 + fail-fast: false 16 24 matrix: 17 - ruby-version: ["3.2", "3.3"] 25 + ruby-version: ${{ fromJson(needs.ruby-versions.outputs.versions) }} 18 26 19 27 steps: 20 28 - uses: actions/checkout@v3
+22 -9
Gemfile.lock
··· 1 1 GIT 2 2 remote: https://github.com/joeldrapper/quickdraw.git 3 - revision: 2c63f35c5f5dedf4625fcbe1825f88786aa65d45 3 + revision: 3a3f2d1e5ae18a2188d5c5906c9fbd80a592c773 4 4 specs: 5 5 quickdraw (0.1.0) 6 6 ··· 20 20 docile (1.4.1) 21 21 e2mmap (0.1.0) 22 22 jaro_winkler (1.6.0) 23 + jaro_winkler (1.6.0-java) 23 24 json (2.7.2) 25 + json (2.7.2-java) 24 26 kramdown (2.4.0) 25 27 rexml 26 28 kramdown-parser-gfm (1.1.0) 27 29 kramdown (~> 2.0) 28 30 language_server-protocol (3.17.0.3) 29 - nokogiri (1.16.6-aarch64-linux) 31 + mini_portile2 (2.8.7) 32 + nokogiri (1.16.7) 33 + mini_portile2 (~> 2.8.2) 30 34 racc (~> 1.4) 31 - nokogiri (1.16.6-arm-linux) 35 + nokogiri (1.16.7-aarch64-linux) 32 36 racc (~> 1.4) 33 - nokogiri (1.16.6-arm64-darwin) 37 + nokogiri (1.16.7-arm-linux) 38 + racc (~> 1.4) 39 + nokogiri (1.16.7-arm64-darwin) 40 + racc (~> 1.4) 41 + nokogiri (1.16.7-java) 34 42 racc (~> 1.4) 35 - nokogiri (1.16.6-x86-linux) 43 + nokogiri (1.16.7-x86-linux) 36 44 racc (~> 1.4) 37 - nokogiri (1.16.6-x86_64-darwin) 45 + nokogiri (1.16.7-x86_64-darwin) 38 46 racc (~> 1.4) 39 - nokogiri (1.16.6-x86_64-linux) 47 + nokogiri (1.16.7-x86_64-linux) 40 48 racc (~> 1.4) 41 49 parallel (1.25.1) 42 50 parser (3.3.3.0) 43 51 ast (~> 2.4.1) 44 52 racc 45 53 prism (0.29.0) 46 - racc (1.8.0) 54 + racc (1.8.1) 55 + racc (1.8.1-java) 47 56 rainbow (3.1.1) 48 57 rbs (2.8.4) 49 58 regexp_parser (2.9.2) ··· 93 102 yard (~> 0.9, >= 0.9.24) 94 103 sorbet-runtime (0.5.11466) 95 104 strscan (3.1.0) 105 + strscan (3.1.0-java) 96 106 thor (1.3.1) 97 107 tilt (2.4.0) 98 108 unicode-display_width (2.5.0) ··· 102 112 aarch64-linux 103 113 arm-linux 104 114 arm64-darwin 115 + java 116 + ruby 105 117 x86-linux 106 118 x86_64-darwin 107 119 x86_64-linux 120 + x86_64-linux-musl 108 121 109 122 DEPENDENCIES 110 123 benchmark-ips ··· 116 129 solargraph 117 130 118 131 BUNDLED WITH 119 - 2.5.7 132 + 2.5.22
+1
config/quickdraw.rb
··· 2 2 3 3 require "literal" 4 4 require "securerandom" 5 + require "set" 5 6 6 7 module Fixtures 7 8 Objects = Set[
+9
lib/literal/data_structure.rb
··· 51 51 [1, to_h, frozen?] 52 52 end 53 53 54 + def hash 55 + self.class.hash 56 + end 57 + 58 + def ==(other) 59 + other.is_a?(self.class) && other.class.literal_properties.empty? 60 + end 61 + alias eql? == 62 + 54 63 def self.__generate_literal_methods__(new_property, buffer = +"") 55 64 super 56 65 literal_properties.generate_hash(buffer)
+4
lib/literal/enum.rb
··· 90 90 def __after_defined__ 91 91 raise ArgumentError if frozen? 92 92 93 + if RUBY_VERSION < "3.2" 94 + constants(false).each { |name| const_added(name) } 95 + end 96 + 93 97 @indexes.each do |name, (type, unique, block)| 94 98 index = @members.group_by(&block).freeze 95 99
+4
lib/literal/properties.rb
··· 80 80 @__literal_extension__ 81 81 else 82 82 @__literal_extension__ = Module.new do 83 + def initialize 84 + after_initialize if respond_to?(:after_initialize) 85 + end 86 + 83 87 def to_h 84 88 {} 85 89 end
+4
lib/literal/properties/schema.rb
··· 42 42 @sorted_properties.size 43 43 end 44 44 45 + def empty? 46 + @sorted_properties.empty? 47 + end 48 + 45 49 def generate_initializer(buffer = +"") 46 50 buffer << "def initialize(#{generate_initializer_params})\n" 47 51 generate_initializer_body(buffer)
+2 -2
test/data.test.rb
··· 67 67 expect(empty.hash) == other.hash 68 68 69 69 other_empty = Class.new(Literal::Data).new 70 - expect(empty) == other_empty 71 - expect(empty).to_eql?(other_empty) 70 + expect(empty) != other_empty 71 + expect(empty).not_to_eql?(other_empty) 72 72 expect(empty.hash) != other_empty.hash 73 73 end
+2 -2
test/enum.test.rb
··· 42 42 expect(Color.cast(1)) == Color::Red 43 43 expect(Color.to_set) == Set[Color::Red, Color::Green, Color::Blue] 44 44 expect(Color.to_h) == { 1 => Color::Red, 2 => Color::Green, 3 => Color::Blue } 45 - expect(Color.to_a) == [Color::Red, Color::Green, Color::Blue] 46 - expect(Color.values) == [1, 2, 3] 45 + expect(Color.to_a) == [Color::Red, Color::Green, Color::Blue] if RUBY_VERSION >= "3.2" 46 + expect(Color.values) == [1, 2, 3] if RUBY_VERSION >= "3.2" 47 47 expect([3, 2, 1].map(&Color)) == [Color::Blue, Color::Green, Color::Red] 48 48 49 49 expect(Switch::Off.toggle) == Switch::On
+5 -5
test/properties.test.rb
··· 120 120 expect(error.message) == <<~ERROR 121 121 Type mismatch 122 122 123 - Quickdraw::Context(in #{__FILE__})::Person#initialize (from #{__FILE__}:#{__LINE__ - 4}:in `block (3 levels) in load_tests') 123 + #{Person}#initialize (from #{__FILE__}:#{__LINE__ - 4}:in `block (3 levels) in load_tests') 124 124 name 125 125 Expected: String 126 126 Actual (Integer): 1 ··· 292 292 expect(error.message) == <<~ERROR 293 293 Type mismatch 294 294 295 - Quickdraw::Context(in #{__FILE__})::Family#initialize (from #{__FILE__}:#{__LINE__ - 16}:in `block (3 levels) in load_tests') 295 + #{Family}#initialize (from #{__FILE__}:#{__LINE__ - 16}:in `block (3 levels) in load_tests') 296 296 members 297 297 [0] 298 298 [:role] ··· 309 309 expect(error.message) == <<~ERROR 310 310 Type mismatch 311 311 312 - Quickdraw::Context(in #{__FILE__})::Family#initialize (from #{__FILE__}:#{__LINE__ - 4}:in `block (3 levels) in load_tests') 312 + #{Family}#initialize (from #{__FILE__}:#{__LINE__ - 4}:in `block (3 levels) in load_tests') 313 313 members 314 314 [0] 315 - Expected: _Map({:person=>Quickdraw::Context(in #{__FILE__})::Person, :role=>Symbol}) 315 + Expected: _Map({:person=>#{Person}, :role=>Symbol}) 316 316 Actual (Integer): 1 317 317 ERROR 318 318 } ··· 321 321 expect(error.message) == <<~ERROR 322 322 Type mismatch 323 323 324 - Quickdraw::Context(in #{__FILE__})::Family#initialize (from #{__FILE__}:#{__LINE__ - 4}:in `block (3 levels) in load_tests') 324 + #{Family}#initialize (from #{__FILE__}:#{__LINE__ - 4}:in `block (3 levels) in load_tests') 325 325 last_reunion_year: 326 326 Expected: _Nilable(Integer) 327 327 Actual (Symbol): :two_thousand