diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-01-01 17:15:51 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-01-01 17:17:23 -0800 |
| commit | 3e89092833a6d407e711fe4ae5f44474ff34cf64 (patch) | |
| tree | 5ffe2df86f648b604347b59999992d74f71a796c /lib/file_hash.nom | |
| parent | e68eb04d690454428216a0f0f1b11399feeb7dc1 (diff) | |
Some changes to the error API, a fix for statement block parsing, and
replacing ((foo 1 baz)'s meaning) with $(foo 1 baz).
Diffstat (limited to 'lib/file_hash.nom')
| -rw-r--r-- | lib/file_hash.nom | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/file_hash.nom b/lib/file_hash.nom index a708249..ec39e29 100644 --- a/lib/file_hash.nom +++ b/lib/file_hash.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.13.12.8 +#!/usr/bin/env nomsu -V6.14 # This file defines some actions for hashing files and looking up files by hash. @@ -10,11 +10,12 @@ use "lib/base64.nom" lua> "local \$use_sha1, \$hashlib = pcall(require, 'openssl.digest')" test: assume (hash "hello world") == (hash "hello world") - assume ((hash "hello world") != (hash "goodbye")) or barf (" - Hash collision: - (hash "hello world") = \(hash "hello world") - (hash "goodbye") = \(hash "goodbye") - ") + if ((hash "hello world") == (hash "goodbye")): + fail (" + Hash collision: + (hash "hello world") = \(hash "hello world") + (hash "goodbye") = \(hash "goodbye") + ") assume ( @@ -24,8 +25,8 @@ test: ") ) != "inf" - assume ((hash "\000") != (hash "\000\000\000\000\000")) or barf - "Incorrect hashing of null strings" + if ((hash "\000") == (hash "\000\000\000\000\000")): + fail "Incorrect hashing of null strings" if $use_sha1: assume ((hash "hello world") == "Kq5sNclPz7QV2+lfQIuc6R7oRu0=") |
