-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
299 changed files
with
6,367 additions
and
2,542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,61 @@ | ||
{ config, lib, ... }: | ||
|
||
let inherit (lib) concatStringsSep mapAttrsToList mkMerge mkOption types gvariant; | ||
in { | ||
options.examples = mkOption { type = types.attrsOf gvariant; }; | ||
{ | ||
options = { | ||
examples = lib.mkOption { type = lib.types.attrs; }; | ||
assertion = lib.mkOption { type = lib.types.bool; }; | ||
}; | ||
|
||
config = { | ||
examples = with gvariant; | ||
mkMerge [ | ||
{ bool = true; } | ||
{ bool = true; } | ||
|
||
{ float = 3.14; } | ||
|
||
{ int32 = mkInt32 (- 42); } | ||
{ int32 = mkInt32 (- 42); } | ||
|
||
{ uint32 = mkUint32 42; } | ||
{ uint32 = mkUint32 42; } | ||
|
||
{ int16 = mkInt16 (-42); } | ||
{ int16 = mkInt16 (-42); } | ||
|
||
{ uint16 = mkUint16 42; } | ||
{ uint16 = mkUint16 42; } | ||
|
||
{ int64 = mkInt64 (-42); } | ||
{ int64 = mkInt64 (-42); } | ||
|
||
{ uint64 = mkUint64 42; } | ||
{ uint64 = mkUint64 42; } | ||
|
||
{ array1 = [ "one" ]; } | ||
{ array1 = mkArray [ "two" ]; } | ||
{ array2 = mkArray [ (mkInt32 1) ]; } | ||
{ array2 = mkArray [ (nkUint32 2) ]; } | ||
|
||
{ emptyArray1 = [ ]; } | ||
{ emptyArray2 = mkEmptyArray type.uint32; } | ||
|
||
{ string = "foo"; } | ||
{ string = "foo"; } | ||
{ | ||
escapedString = '' | ||
'\ | ||
''; | ||
} | ||
|
||
{ tuple = mkTuple [ (mkInt32 1) [ "foo" ] ]; } | ||
|
||
{ maybe1 = mkNothing type.string; } | ||
{ maybe2 = mkJust (mkUint32 4); } | ||
|
||
{ variant1 = mkVariant "foo"; } | ||
{ variant2 = mkVariant 42; } | ||
|
||
{ dictionaryEntry = mkDictionaryEntry (mkInt32 1) [ "foo" ]; } | ||
]; | ||
|
||
assertions = [ | ||
{ | ||
assertion = ( | ||
let | ||
mkLine = n: v: "${n} = ${toString (gvariant.mkValue v)}"; | ||
result = concatStringsSep "\n" (mapAttrsToList mkLine config.examples); | ||
in | ||
result + "\n" | ||
) == '' | ||
array1 = @as ['one','two'] | ||
array2 = @au [1,2] | ||
bool = true | ||
dictionaryEntry = @{ias} {1,@as ['foo']} | ||
emptyArray1 = @as [] | ||
emptyArray2 = @au [] | ||
escapedString = '\'\\\n' | ||
float = 3.140000 | ||
int = -42 | ||
int16 = @n -42 | ||
int64 = @x -42 | ||
maybe1 = @ms nothing | ||
maybe2 = just @u 4 | ||
string = 'foo' | ||
tuple = @(ias) (1,@as ['foo']) | ||
uint16 = @q 42 | ||
uint32 = @u 42 | ||
uint64 = @t 42 | ||
variant1 = @v <'foo'> | ||
variant2 = @v <42> | ||
''; | ||
} | ||
]; | ||
examples = with lib.gvariant; { | ||
bool = true; | ||
float = 3.14; | ||
int32 = mkInt32 (- 42); | ||
uint32 = mkUint32 42; | ||
int16 = mkInt16 (-42); | ||
uint16 = mkUint16 42; | ||
int64 = mkInt64 (-42); | ||
uint64 = mkUint64 42; | ||
array1 = [ "one" ]; | ||
array2 = mkArray [ (mkInt32 1) ]; | ||
array3 = mkArray [ (mkUint32 2) ]; | ||
emptyArray = mkEmptyArray type.uint32; | ||
string = "foo"; | ||
escapedString = '' | ||
'\ | ||
''; | ||
tuple = mkTuple [ (mkInt32 1) [ "foo" ] ]; | ||
maybe1 = mkNothing type.string; | ||
maybe2 = mkJust (mkUint32 4); | ||
variant = mkVariant "foo"; | ||
dictionaryEntry = mkDictionaryEntry (mkInt32 1) [ "foo" ]; | ||
}; | ||
|
||
assertion = | ||
let | ||
mkLine = n: v: "${n} = ${toString (lib.gvariant.mkValue v)}"; | ||
result = lib.concatStringsSep "\n" (lib.mapAttrsToList mkLine config.examples); | ||
in | ||
(result + "\n") == '' | ||
array1 = @as ['one'] | ||
array2 = @ai [1] | ||
array3 = @au [@u 2] | ||
bool = true | ||
dictionaryEntry = @{ias} {1,@as ['foo']} | ||
emptyArray = @au [] | ||
escapedString = '\'\\\n' | ||
float = 3.140000 | ||
int16 = @n -42 | ||
int32 = -42 | ||
int64 = @x -42 | ||
maybe1 = @ms nothing | ||
maybe2 = just @u 4 | ||
string = 'foo' | ||
tuple = @(ias) (1,@as ['foo']) | ||
uint16 = @q 42 | ||
uint32 = @u 42 | ||
uint64 = @t 42 | ||
variant = <'foo'> | ||
''; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1768,6 +1768,15 @@ | |
githubId = 1222; | ||
name = "Aaron VonderHaar"; | ||
}; | ||
aviallon = { | ||
email = "[email protected]"; | ||
github = "aviallon"; | ||
githubId = 7479436; | ||
name = "Antoine Viallon"; | ||
keys = [{ | ||
fingerprint = "4AC4 A28D 7208 FC6F 2B51 5EA9 D126 B13A B555 E16F"; | ||
}]; | ||
}; | ||
avitex = { | ||
email = "[email protected]"; | ||
github = "avitex"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.