Unverified Commit 74cfe461 authored by Zexin Yuan's avatar Zexin Yuan Committed by Defelo
Browse files

taplo: add toml-test

parent e110e409
Loading
Loading
Loading
Loading
+39 −2
Original line number Diff line number Diff line
@@ -5,10 +5,16 @@
  fetchFromGitHub,
  pkg-config,
  openssl,
  withLsp ? true,
  installShellFiles,
  versionCheckHook,

  # passthru dependencies
  nix-update-script,
  runCommand,
  toml-test,

  # Optional feature
  withLsp ? true,
}:

rustPlatform.buildRustPackage (finalAttrs: {
@@ -52,7 +58,38 @@ rustPlatform.buildRustPackage (finalAttrs: {
  versionCheckProgramArg = "--version";
  doInstallCheck = true;

  passthru.updateScript = nix-update-script { };
  passthru = {
    updateScript = nix-update-script { };

    tests = {
      toml-test =
        let
          # Unfortunately, taplo does not yet pass all toml-test v1.6.0 tests.
          # Some of the failures are reported issues, others may not be.
          # https://github.com/tamasfe/taplo/issues/486
          skips = [
            "valid/comment/nonascii"
            "valid/datetime/edge"
            "valid/key/quoted-unicode"
            "valid/string/quoted-unicode"
            "invalid/control/multi-cr"
            "invalid/control/rawmulti-cr"
            "invalid/table/super-twice"
          ];
        in
        runCommand "taplo-toml-test"
          {
            nativeBuildInputs = [
              finalAttrs.finalPackage
              toml-test
            ];
          }
          ''
            toml-test taplo ${lib.concatMapStringsSep " " (a: "-skip ${a}") skips} -- toml-test
            touch "$out"
          '';
    };
  };

  meta = {
    description = "TOML toolkit written in Rust";