yq: Add test

This commit is contained in:
Tim Steinbach 2020-12-18 12:07:30 -05:00
parent 9e6737710c
commit 648eece4bf
No known key found for this signature in database
GPG key ID: 6538CB9266B06F31
3 changed files with 16 additions and 0 deletions

View file

@ -411,6 +411,7 @@ in
xterm = handleTest ./xterm.nix {};
yabar = handleTest ./yabar.nix {};
yggdrasil = handleTest ./yggdrasil.nix {};
yq = handleTest ./yq.nix {};
zfs = handleTest ./zfs.nix {};
zigbee2mqtt = handleTest ./zigbee2mqtt.nix {};
zoneminder = handleTest ./zoneminder.nix {};

12
nixos/tests/yq.nix Normal file
View file

@ -0,0 +1,12 @@
import ./make-test-python.nix ({ pkgs, ... }: {
name = "yq";
meta = with pkgs.stdenv.lib.maintainers; { maintainers = [ nequissimus ]; };
nodes.yq = { pkgs, ... }: { environment.systemPackages = with pkgs; [ jq yq ]; };
testScript = ''
assert "hello:\n foo: bar\n" in yq.succeed(
'echo \'{"hello":{"foo":"bar"}}\' | yq -y .'
)
'';
})

View file

@ -1,4 +1,5 @@
{ lib
, nixosTests
, buildPythonPackage
, fetchPypi
, pkgs
@ -46,6 +47,8 @@ buildPythonPackage rec {
pythonImportsCheck = [ "yq" ];
passthru.tests = { inherit (nixosTests) yq; };
meta = with lib; {
description = "Command-line YAML processor - jq wrapper for YAML documents";
homepage = "https://github.com/kislyuk/yq";