summary refs log tree commit diff stats
path: root/tests/stdlib/tsha1.nim
diff options
context:
space:
mode:
authorIvan Bobev <bobeff@gmail.com>2021-07-15 23:13:01 +0300
committerGitHub <noreply@github.com>2021-07-15 22:13:01 +0200
commit5e6680406f39b2b0b90d8b137285e066cc358d43 (patch)
treeff522b30e40a1f374f389de805f9aedc8e1b76c1 /tests/stdlib/tsha1.nim
parent1d6863a7899fd87fd9eb017ae370ef37db18ad32 (diff)
downloadNim-5e6680406f39b2b0b90d8b137285e066cc358d43.tar.gz
Add changes required by Nimble lock file support (#12104)
Implemented support for Nimble local cache with package directories with
a checksum of the package at the end of their names. Now the compiler
supports package paths in the form:

 * /path_to_nimble_cache_dir/pkgs/package_name-1.2.3-
FEBADEAEA2345E777F0F6F8433F7F0A52EDD5D1B

 * /path_to_nimble_cache_dir/pkgs/package_name-#head-
042D4BE2B90ED0672E717D71850ABDB0A2D19CD2

 * /path_to_nimble_cache_dir/pkgs/package_name-#branch-name-
DBC1F902CB79946E990E38AF51F0BAD36ACFABD9

Related to nim-lang/nimble#127
Diffstat (limited to 'tests/stdlib/tsha1.nim')
-rw-r--r--tests/stdlib/tsha1.nim10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/stdlib/tsha1.nim b/tests/stdlib/tsha1.nim
index 7e67ccaf6..a20183039 100644
--- a/tests/stdlib/tsha1.nim
+++ b/tests/stdlib/tsha1.nim
@@ -11,3 +11,13 @@ checkVector("", "da39a3ee5e6b4b0d3255bfef95601890afd80709")
 checkVector("abc", "a9993e364706816aba3e25717850c26c9cd0d89d")
 checkVector("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
             "84983e441c3bd26ebaae4aa1f95129e5e54670f1")
+
+proc testIsValidSha1Hash =
+  doAssert not isValidSha1Hash("")
+  doAssert not isValidSha1Hash("042D4BE2B90ED0672E717D71850ABDB0A2D19CD11")
+  doAssert not isValidSha1hash("042G4BE2B90ED0672E717D71850ABDB0A2D19CD1")
+  doAssert isValidSha1Hash("042D4BE2B90ED0672E717D71850ABDB0A2D19CD1")
+  doAssert isValidSha1Hash("042d4be2b90ed0672e717d71850abdb0a2d19cd1")
+  doAssert isValidSha1Hash("042d4be2b90ed0672e717D71850ABDB0A2D19CD1")
+
+testIsValidSha1Hash()