hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 378594c4e94c8d1a67a5c60629c1ed1598a83f72
parent c6c03614587cb0626e32a4cc0c52161c52182285
Author: Bor Grošelj Simić <bor.groseljsimic@telemach.net>
Date:   Tue, 16 Feb 2021 01:36:06 +0100

bytes::tokenize: add a test for remaining_tokens()

Diffstat:
Mbytes/tokenize.ha | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/bytes/tokenize.ha b/bytes/tokenize.ha @@ -119,4 +119,19 @@ export fn remaining_tokens(s: *tokenizer) []u8 = { }; assert(next_token(&t) is void); + + const input5: [_]u8 = [24, 42, 1, 24, 42, 2, 3, 4]; + t = tokenize(input5, [24, 42]); + + match (next_token(&t)) { + b: []u8 => assert(equal([], b)), + void => abort(), + }; + + match (next_token(&t)) { + b: []u8 => assert(equal([1], b)), + void => abort(), + }; + + assert(equal(remaining_tokens(&t), [2, 3, 4])); };