Improving Marshal specs
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
- Tipo di issue
- Refactoring
- Chiarezza
- Da chiarire
- Stato di attività
- Tranquilla
- Stack tecnologico
- ruby
- Ambito
- testing-qa
Direzione di ricerca
Inizia leggendo spec/ruby/core/marshal/dump_spec.rb e l’uso esistente delle fixture DATA e DATA_19, quindi riproduci i fallimenti di dump di Range segnalati. Confronta la struttura attuale delle spec di dump e load e determina come le fixture dovrebbero coprire entrambe le direzioni, incluso il caso ricorsivo di Set di jruby/jruby#9405. Il lavoro è completo quando le spec di Marshal usano un approccio chiaro e manutenibile e includono la copertura necessaria di Set senza accumulare blocchi personalizzati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
We recently received a bug report about improper linking during recursive Set dumping and loading (jruby/jruby#9405). The fix is simple, but attempting to add a spec for it brought to my attention how messy the existing Marshal specs are.
Many classes have custom spec blocks when they could be using the DATA or DATA_19 fixtures. Those fixtures currently appear to only be used for verifying loads; when I tried to use them to also verify the output of dumps, several of them fail:
1)
Marshal.dump 1..2 returns the expected output FAILED
Expected
"\x04\bo:
Range\b:\texclF:
begini\x06:\bendi\a" ==
"\x04\bo:
Range\b:
begini\x06:\texclF:\bendi\a"
to be truthy but was false
/Users/headius/work/jruby/spec/ruby/core/marshal/dump_spec.rb:1011:in 'block (3 levels) in <top (required)>'
/Users/headius/work/jruby/spec/ruby/core/marshal/dump_spec.rb:6:in '<top (required)>'
2)
Marshal.dump 1...2 returns the expected output FAILED
Expected
"\x04\bo:
Range\b:\texclT:
begini\x06:\bendi\a" ==
"\x04\bo:
Range\b:
begini\x06:\texclT:\bendi\a"
to be truthy but was false
/Users/headius/work/jruby/spec/ruby/core/marshal/dump_spec.rb:1011:in 'block (3 levels) in <top (required)>'
/Users/headius/work/jruby/spec/ruby/core/marshal/dump_spec.rb:6:in '<top (required)>'
...more
Both the load and dump specs have also gotten very large, making maintenance difficult. They contain logic specific to various other core types, and frequently hardcode marshal output strings that appear to have changed slightly over time.
I file this because I'm not sure the best course of action to clean this up. The specs I need for jruby/jruby#9405 would be small (and also the first Set-related Marshal specs), but I'm reluctant to just add another custom spec block for such simple cases. It would be nice to figure out the "right" way to handle Marshal dump and load specs so this doesn't continue to compound.
A few thoughts here:
- Perhaps the marshal logic for each core class should live in that class's spec directory? There could be some common fixture code to make it trivial, but even if they don't all override
dumpandloadlogic, they all have unique Marshal formats. - Alternatively, could we clean up the canned
DATAandDATA_19hashes so that they fully pass for those cases, and only use custom specs when such canned cases can't be easily automated (such as recursive collections)?
- Lingua principale
- Ruby
- Stelle
- 622
- Fork
- 402
- Merge medio
- 14h 51m
- PR unite (30g)
- 6
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ruby/spec
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
-
Hacktoberfest help wanted
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
palladius/rails8-app-on-gcp#145 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
rubocop/rubocop-rspec#2236 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
riscv/riscv-unified-db#2624 · 1 reazione ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100