CodeSampleX

Пример

nimble_csv 1.3.0: Configure a tab delimiter at NimbleCSV 1.3.0 parser definition time instead of passing a parse-time separator option

Проверенный пример — hex nimble_csv 1.3.0: Configure a tab delimiter at NimbleCSV 1.3.0 parser definition time instead of passing a parse-time separator…

sha256:e26e7d1b6ecc2ba028b74978148bdf04a5a677f286835fcb763b7c7347d24c87

Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла. Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди. MIT-0

Свидетельства выполнения

Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.

Основа свидетельства
Подписанный контракт пройден
Квитанции проверки
2
Ключи подписи, собравшие его
2
Заявленная среда elixir 1 linux x64 elixir 1 elixir mix

Среды запусков проверки

Окружение Контракт Этапы Запуск
elixir 1 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:PASS · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · hex@1
2026-08-17
elixir 1 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:PASS · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · hex@1
2026-08-18

Кейс

HOW
Цель
Configure a tab delimiter at NimbleCSV 1.3.0 parser definition time instead of passing a parse-time separator option
Пакеты
Символы
  • NimbleCSV.RFC4180.parse_string/2
  • NimbleCSV.define/2
  • NimbleCSV.parse_string/2
Окружение
elixir 1
Создан
2026-08-17T04:44:18Z

Контракт

  1. assert RFC4180 parse_string with separator: tab and skip_headers: false keeps each tabbed line as one field
  2. assert a module created by NimbleCSV.define with a tab separator splits the same input into three fields per row

Файлы

  • NOTES.md
  • csx.json
  • mix.exs
  • mix.lock
  • test/contract_test.exs
  • test/test_helper.exs

Скачать артефакт с исходным кодом (tar.gz)

Исходный код

NOTES.md
# NimbleCSV 1.3.0 separator configuration

`NimbleCSV.RFC4180` is already configured with a comma delimiter. Passing a
tab in the runtime options does not reconfigure it; with header skipping
disabled, each tabbed line remains one field. A module created with
`NimbleCSV.define/2` and `separator: "\t"` splits the identical input into
three fields. No other version is claimed.
csx.json
{"buildCommand":["mix","deps.compile","--no-deps-check"],"case":{"believed":"Passing separator: \"\\t\" to NimbleCSV.RFC4180.parse_string/2 changes that predefined parser's delimiter for the call.","caseId":"case:sha256:14bc2ff888c8ffd392a1701b2883becb876052a09db6d17769d1a3c344a34395","contract":["assert RFC4180 parse_string with separator: tab and skip_headers: false keeps each tabbed line as one field","assert a module created by NimbleCSV.define with a tab separator splits the same input into three fields per row"],"goal":"Configure a tab delimiter at NimbleCSV 1.3.0 parser definition time instead of passing a parse-time separator option","kind":"HOW","packages":["pkg:hex/nimble_csv@1.3.0"],"schemaVersion":1,"symbols":["NimbleCSV.RFC4180.parse_string/2","NimbleCSV.define/2","NimbleCSV.parse_string/2"]},"contractCommand":["mix","test","--no-deps-check"],"environment":{"arch":"x64","ecosystem":"hex","executionContext":"elixir","language":"elixir","os":"linux","packageManager":"mix","runtime":"elixir","runtimeVersion":"1","schemaVersion":1},"license":"MIT-0","packages":["pkg:hex/nimble_csv@1.3.0"],"schemaVersion":1,"symbols":["NimbleCSV.RFC4180.parse_string/2","NimbleCSV.define/2","NimbleCSV.parse_string/2"],"verifierAdapter":"hex@1"}
mix.exs
defmodule CsxNimbleCsvSeparator.MixProject do
  use Mix.Project

  def project do
    [
      app: :csx_nimble_csv_separator,
      version: "0.1.0",
      elixir: "~> 1.15",
      deps: [{:nimble_csv, "1.3.0"}]
    ]
  end

  def application, do: [extra_applications: []]
end
mix.lock
%{
  "nimble_csv": {:hex, :nimble_csv, "1.3.0", "b7f998dc62b222bce9596e46f028c7a5af04cb5dde6df2ea197c583227c54971", [:mix], [], "hexpm", "41ccdc18f7c8f8bb06e84164fc51635321e80d5a3b450761c4997d620925d619"},
}
test/contract_test.exs
NimbleCSV.define(CsXTabCSV, separator: "\t", escape: "\"")

defmodule CsxNimbleCsvSeparatorTest do
  use ExUnit.Case, async: true

  @tabular "a\tb\tc\n1\t2\t3"

  test "parse-time separator option does not reconfigure RFC4180" do
    assert NimbleCSV.RFC4180.parse_string(@tabular,
             separator: "\t",
             skip_headers: false
           ) == [["a\tb\tc"], ["1\t2\t3"]]
  end

  test "a parser defined with a tab separator splits the same input" do
    assert CsXTabCSV.parse_string(@tabular, skip_headers: false) ==
             [["a", "b", "c"], ["1", "2", "3"]]
  end
end
test/test_helper.exs
ExUnit.start()

Исходный сидер

csx-seed