CodeSampleX

샘플

nimble_csv 1.3.0: Define a NimbleCSV parser module and parse and dump CSV with it: header skipping, quoted fields holding separators and newlines, parse errors, and iodata output

검증된 샘플 — hex nimble_csv 1.3.0: Define a NimbleCSV parser module and parse and dump CSV with it: header skipping, quoted fields holding separators and…

sha256:5cc42ad8f6260280ff21c0786a675829539b5451403d0a85eaeda6db06e16e3a

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 elixir 1 linux x64 elixir 1 elixir mix

검증 실행 환경

환경 컨트랙트 단계 실행일
elixir 1 · linux alpine/x64 · docker ed25519:a2ec939a4c60e243 PASS compile:PASS · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · hex@1
2026-08-14

케이스

HOW
목표
Define a NimbleCSV parser module and parse and dump CSV with it: header skipping, quoted fields holding separators and newlines, parse errors, and iodata output
패키지
심벌
  • NimbleCSV.define
  • NimbleCSV.RFC4180
  • NimbleCSV.RFC4180.parse_string
  • NimbleCSV.RFC4180.parse_enumerable
  • NimbleCSV.RFC4180.parse_stream
  • NimbleCSV.RFC4180.dump_to_iodata
  • NimbleCSV.ParseError
환경
elixir 1
생성일
2026-08-14T20:10:34Z

컨트랙트

  1. assert NimbleCSV.define/2 is an ordinary function and not a macro, so it can be called at runtime, and that calling it a second time emits a redefining module warning on stderr
  2. assert a bare alias passed to define/2 creates a top-level module rather than one nested under the enclosing module
  3. assert a parser defined with a separator list round-trips a table, accepts every separator when parsing but writes only the first when dumping, and treats all of them as reserved characters
  4. assert the RFC4180 parser keeps a separator and a newline that sit inside a quoted field, returns the inner newline bytes verbatim rather than normalising CRLF to LF, and reads a doubled quote as one literal quote
  5. assert parse_string discards the first line by default, so a headerless single-row CSV parses to an empty list, and that skip_headers: false keeps it
  6. assert broken escaping raises NimbleCSV.ParseError with either the end-of-file or the unexpected-escape-character message, while a ragged row of the wrong width raises nothing and is returned as-is
  7. assert eager parse_string and parse_enumerable raise before yielding any row, while lazy parse_stream returns the rows before the broken line when the stream is halted early
  8. assert dump_to_iodata returns a nested list holding binaries and raw single-byte integers rather than a binary, that RFC4180 dumps CRLF row terminators while a custom parser can dump LF, that reserved characters are quoted on the way out, and that entries are dumped through to_string while parsing always returns binaries

파일

  • csx.json
  • lib/csx_nimble_csv/parsers.ex
  • mix.exs
  • mix.lock
  • test/contract_test.exs
  • test/test_helper.exs

소스 아티팩트 내려받기 (tar.gz)

오리진 시더

anonymous