Exemplo
csv 3.3.2: Show that CSV 3.x keeps a newline default row separator even when `$INPUT_RECORD_SEPARATOR` is changed.
Amostra verificada para gem csv 3.3.2: Show that CSV 3.x keeps a newline default row separator even when `$INPUT_RECORD_SEPARATOR` is changed. O contrato…
sha256:8771a54526218ff223716c59c0657cf20277db84079a3ec050dd90ddacf8b22f
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 2
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
ruby linux x64 ruby ruby bundler
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| ruby 3 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · rubygems@1 |
2026-08-16 |
| ruby 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 | SKIPPED | compile:SKIPPED · contract:SKIPPED · load:SKIPPED · resolve:FAIL CONTAINER_RUN · rubygems@1 |
2026-08-18 |
Caso
HOW- Objetivo
- Show that CSV 3.x keeps a newline default row separator even when `$INPUT_RECORD_SEPARATOR` is changed.
- Pacotes
- Símbolos
-
- CSV.new
- Ambiente
- ruby
- Criado
- 2026-08-16T15:32:31Z
Contrato
- assert that setting `$INPUT_RECORD_SEPARATOR` to "|" and calling `CSV.new("a,b")` yields `row_sep == "\n"`
- assert that `CSV.generate_line(["a", "b"])` still ends in "\n" after `$INPUT_RECORD_SEPARATOR` is changed to "|"
Arquivos
- Gemfile
- NOTES.md
- csx.json
- test/contract.rb
Código-fonte
source "https://rubygems.org"
gem "csv", "3.3.2"
`search_known_solution` already returned a HIT for this package: sha256:8f9a1d4bba7bafae896c8862e6cc34aa3d64cb931492106f55207f395dde64bb (goal: Fix LoadError for csv or base64 after a Ruby upgrade).
A naive v2-style expectation that `$INPUT_RECORD_SEPARATOR` controls the default `row_sep` is wrong here: under csv 3.3.2, defaults are newline-based, so changing `$/` silently changes behavior in `CSV.new`/`CSV.generate_line` expectations that assume inheritance from `$/`.
{"case":{"believed":"A good model expects CSV to inherit its default `row_sep` from `$INPUT_RECORD_SEPARATOR` whenever `row_sep` is not passed.","caseId":"case:sha256:ce29bd6948e69fd88b78a9cc17e0f7f8aa9b563eac79fa536a1f5e8ad05f77a1","contract":["assert that setting `$INPUT_RECORD_SEPARATOR` to \"|\" and calling `CSV.new(\"a,b\")` yields `row_sep == \"\\n\"`","assert that `CSV.generate_line([\"a\", \"b\"])` still ends in \"\\n\" after `$INPUT_RECORD_SEPARATOR` is changed to \"|\""],"goal":"Show that CSV 3.x keeps a newline default row separator even when `$INPUT_RECORD_SEPARATOR` is changed.","kind":"HOW","packages":["pkg:gem/csv@3.3.2"],"schemaVersion":1,"symbols":["CSV.new"]},"contractCommand":["ruby","test/contract.rb"],"environment":{"arch":"x64","ecosystem":"gem","executionContext":"ruby","language":"ruby","os":"linux","packageManager":"bundler","runtime":"ruby","schemaVersion":1},"license":"MIT-0","packages":["pkg:gem/csv@3.3.2"],"schemaVersion":1,"symbols":["CSV.new"],"verifierAdapter":"rubygems@1"}
#!/usr/bin/env ruby
# frozen_string_literal: true
require "csv"
def assert(expected, actual, message)
unless actual == expected
raise "#{message}. expected=#{expected.inspect} actual=#{actual.inspect}"
end
end
$/ = "|"
csv = CSV.new("a,b")
assert("\n", csv.row_sep, "CSV.new should default to newline row separator in Ruby 3's csv gem")
generated = CSV.generate_line(%w[a b])
assert("a,b\n", generated, "CSV.generate_line should end lines with newline even when $/ is changed")
puts "contract passed"