From 6b17a188936d489e2777e541c84112b2609532d5 Mon Sep 17 00:00:00 2001 From: Manlio Perillo Date: Sun, 16 Apr 2023 12:23:10 +0200 Subject: Ensure the exercises use the canonical format Add the check-exercises.py tool in the new tools directory. It is used to check that the exercises are correctly formatted, printing on stderr the invalid ones and the diff in the unified format. Update the exercises that don't use the canonical zig fmt format. Update some patches that cause the generated zig file to be incorrectly formatted. --- patches/patches/024_errors4.patch | 2 +- patches/patches/059_integers.patch | 8 ++++---- patches/patches/083_anonymous_lists.patch | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'patches') diff --git a/patches/patches/024_errors4.patch b/patches/patches/024_errors4.patch index 5996a99..48e0821 100644 --- a/patches/patches/024_errors4.patch +++ b/patches/patches/024_errors4.patch @@ -5,6 +5,6 @@ > if (err == MyNumberError.TooSmall) { > return 10; > } -> +> > return err; > }; diff --git a/patches/patches/059_integers.patch b/patches/patches/059_integers.patch index 50a89a0..7075ebe 100644 --- a/patches/patches/059_integers.patch +++ b/patches/patches/059_integers.patch @@ -1,8 +1,8 @@ 22,24c22,24 -< 0o131, // octal +< 0o131, // octal < 0b1101000, // binary -< 0x66, // hex +< 0x66, // hex --- -> 0o132, // octal +> 0o132, // octal > 0b1101001, // binary -> 0x67, // hex +> 0x67, // hex diff --git a/patches/patches/083_anonymous_lists.patch b/patches/patches/083_anonymous_lists.patch index b981909..94b594b 100644 --- a/patches/patches/083_anonymous_lists.patch +++ b/patches/patches/083_anonymous_lists.patch @@ -1,4 +1,4 @@ 23c23 -< const hello = .{'h', 'e', 'l', 'l', 'o'}; +< const hello = .{ 'h', 'e', 'l', 'l', 'o' }; --- -> const hello: [5]u8 = .{'h', 'e', 'l', 'l', 'o'}; +> const hello: [5]u8 = .{ 'h', 'e', 'l', 'l', 'o' }; -- cgit v1.2.3