mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 04:58:01 +00:00
bahaghari/tests/lib: init
This commit is contained in:
parent
469e5194cc
commit
d0f57db0aa
8
subprojects/bahaghari/tests/default.nix
Normal file
8
subprojects/bahaghari/tests/default.nix
Normal file
@ -0,0 +1,8 @@
|
||||
# This is the unit cases for our Nix project.
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
|
||||
|
||||
{
|
||||
lib = import ./lib { inherit pkgs; };
|
||||
#modules = import ./modules { inherit pkgs; };
|
||||
}
|
9
subprojects/bahaghari/tests/lib/default.nix
Normal file
9
subprojects/bahaghari/tests/lib/default.nix
Normal file
@ -0,0 +1,9 @@
|
||||
{ pkgs }:
|
||||
|
||||
let
|
||||
lib = import ../../lib { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
trivial = import ./trivial { inherit pkgs lib; };
|
||||
tinted-theming = import ./tinted-theming { inherit pkgs lib; };
|
||||
}
|
17
subprojects/bahaghari/tests/lib/tinted-theming/default.nix
Normal file
17
subprojects/bahaghari/tests/lib/tinted-theming/default.nix
Normal file
@ -0,0 +1,17 @@
|
||||
{ pkgs, lib }:
|
||||
|
||||
let
|
||||
sampleBase16Scheme = lib.trivial.importYAML ./sample-base16-scheme.yml;
|
||||
sampleBase24Scheme = lib.trivial.importYAML ./sample-base24-scheme.yml;
|
||||
in
|
||||
pkgs.lib.runTests {
|
||||
testIsBase16 = {
|
||||
expr = lib.tinted-theming.isBase16 sampleBase16Scheme.palette;
|
||||
expected = true;
|
||||
};
|
||||
|
||||
testIsBase24 = {
|
||||
expr = lib.tinted-theming.isBase24 sampleBase24Scheme.palette;
|
||||
expected = true;
|
||||
};
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
system: "base16"
|
||||
name: "Bark on a tree"
|
||||
author: "Gabriel Arazas (https://foodogsquared.one)"
|
||||
variant: "dark"
|
||||
description: "Rusty theme resembling forestry inspired from Nord theme."
|
||||
palette:
|
||||
base00: "2b221f"
|
||||
base01: "412c26"
|
||||
base02: "5c362c"
|
||||
base03: "a45b43"
|
||||
base04: "e1bcb2"
|
||||
base05: "f5ecea"
|
||||
base06: "fefefe"
|
||||
base07: "eb8a65"
|
||||
base08: "d03e68"
|
||||
base09: "df937a"
|
||||
base0A: "afa644"
|
||||
base0B: "85b26e"
|
||||
base0C: "eb914a"
|
||||
base0D: "c67f62"
|
||||
base0E: "8b7ab9"
|
||||
base0F: "7f3F83"
|
@ -0,0 +1,29 @@
|
||||
system: "base24"
|
||||
name: "Flat"
|
||||
author: "FredHappyface (https://github.com/fredHappyface)"
|
||||
variant: "dark"
|
||||
palette:
|
||||
base00: "082845"
|
||||
base01: "1d2845"
|
||||
base02: "2e2e45"
|
||||
base03: "444e5b"
|
||||
base04: "68717b"
|
||||
base05: "8c939a"
|
||||
base06: "b0b6ba"
|
||||
base07: "e7eced"
|
||||
base08: "a82320"
|
||||
base09: "e58d11"
|
||||
base0A: "3c7dd2"
|
||||
base0B: "2d9440"
|
||||
base0C: "2c9370"
|
||||
base0D: "3167ac"
|
||||
base0E: "781aa0"
|
||||
base0F: "541110"
|
||||
base10: "002240"
|
||||
base11: "001629"
|
||||
base12: "d4312e"
|
||||
base13: "e5be0c"
|
||||
base14: "32a548"
|
||||
base15: "35b387"
|
||||
base16: "3c7dd2"
|
||||
base17: "8230a7"
|
109
subprojects/bahaghari/tests/lib/trivial/default.nix
Normal file
109
subprojects/bahaghari/tests/lib/trivial/default.nix
Normal file
@ -0,0 +1,109 @@
|
||||
{ pkgs, lib }:
|
||||
|
||||
let
|
||||
customOctalGlyphs = {
|
||||
"0" = "A";
|
||||
"1" = "B";
|
||||
"2" = "C";
|
||||
"3" = "D";
|
||||
"4" = "E";
|
||||
"5" = "F";
|
||||
"6" = "G";
|
||||
"7" = "H";
|
||||
};
|
||||
|
||||
customBase24Glyphs = {
|
||||
"0" = "0";
|
||||
"1" = "1";
|
||||
"2" = "2";
|
||||
"3" = "3";
|
||||
"4" = "4";
|
||||
"5" = "5";
|
||||
"6" = "6";
|
||||
"7" = "7";
|
||||
"8" = "8";
|
||||
"9" = "9";
|
||||
"10" = "A";
|
||||
"11" = "B";
|
||||
"12" = "C";
|
||||
"13" = "D";
|
||||
"14" = "E";
|
||||
"15" = "F";
|
||||
"16" = "G";
|
||||
"17" = "H";
|
||||
"18" = "I";
|
||||
"19" = "J";
|
||||
"20" = "M";
|
||||
"21" = "N";
|
||||
"22" = "O";
|
||||
"23" = "P";
|
||||
};
|
||||
in
|
||||
pkgs.lib.runTests {
|
||||
testBaseDigitWithCustomOctalGlyph = {
|
||||
expr = lib.trivial.toBaseDigitsWithGlyphs 8 9 customOctalGlyphs;
|
||||
expected = "BB";
|
||||
};
|
||||
|
||||
testBaseDigitWithCustomOctalGlyph2 = {
|
||||
expr = lib.trivial.toBaseDigitsWithGlyphs 8 641 customOctalGlyphs;
|
||||
expected = "BCAB";
|
||||
};
|
||||
|
||||
testBaseDigitWithProperBase24Glyph = {
|
||||
expr = lib.trivial.toBaseDigitsWithGlyphs 24 641 customBase24Glyphs;
|
||||
expected = "12H";
|
||||
};
|
||||
|
||||
testBaseDigitWithProperBase24Glyph2 = {
|
||||
expr = lib.trivial.toBaseDigitsWithGlyphs 24 2583 customBase24Glyphs;
|
||||
expected = "4BF";
|
||||
};
|
||||
|
||||
# We're mainly testing if the underlying YAML library is mostly compliant
|
||||
# with whatever it claims.
|
||||
testImportBasicYAML = {
|
||||
expr = lib.trivial.importYAML ./simple.yml;
|
||||
expected = {
|
||||
hello = "there";
|
||||
how-are-you-doing = "I'm fine. Thank you for asking.\n";
|
||||
"It's a number" = 53;
|
||||
dog-breeds = [ "chihuahua" "golden retriever" ];
|
||||
};
|
||||
};
|
||||
|
||||
testImportTintedThemingBase16YAML = {
|
||||
expr = lib.trivial.importYAML ../tinted-theming/sample-base16-scheme.yml;
|
||||
expected = {
|
||||
system = "base16";
|
||||
name = "Bark on a tree";
|
||||
author = "Gabriel Arazas (https://foodogsquared.one)";
|
||||
description = "Rusty theme resembling forestry inspired from Nord theme.";
|
||||
variant = "dark";
|
||||
palette = {
|
||||
base00 = "2b221f";
|
||||
base01 = "412c26";
|
||||
base02 = "5c362c";
|
||||
base03 = "a45b43";
|
||||
base04 = "e1bcb2";
|
||||
base05 = "f5ecea";
|
||||
base06 = "fefefe";
|
||||
base07 = "eb8a65";
|
||||
base08 = "d03e68";
|
||||
base09 = "df937a";
|
||||
base0A = "afa644";
|
||||
base0B = "85b26e";
|
||||
base0C = "eb914a";
|
||||
base0D = "c67f62";
|
||||
base0E = "8b7ab9";
|
||||
base0F = "7f3F83";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# YAML is a superset of JSON (or was it the other way around?) after v1.2.
|
||||
testToYAML = {
|
||||
expr = lib.trivial.toYAML { } { hello = "there"; };
|
||||
expected = "{\"hello\":\"there\"}";
|
||||
};
|
||||
}
|
7
subprojects/bahaghari/tests/lib/trivial/simple.yml
Normal file
7
subprojects/bahaghari/tests/lib/trivial/simple.yml
Normal file
@ -0,0 +1,7 @@
|
||||
hello: there
|
||||
how-are-you-doing: |
|
||||
I'm fine. Thank you for asking.
|
||||
It's a number: 53
|
||||
dog-breeds:
|
||||
- chihuahua
|
||||
- golden retriever
|
Loading…
Reference in New Issue
Block a user