Skip to content

Commit

Permalink
exercises(linked-list): test: fix for Zig 0.12.0-dev (#366)
Browse files Browse the repository at this point in the history
ee7 says:
The latest Zig master release produced a compile error for this test:

    $ zig version
    0.12.0-dev.2063+804cee3b9
    $ bin/run-tests linked-list
    Running tests for linked-list...
    test_linked_list.zig:71:9: error: local variable is never mutated
        var list = List{};
            ^~~~
    test_linked_list.zig:71:9: note: consider using 'const'

Officially, the Zig track currently supports only Zig 0.11.0 (released
on 2023-08-04), but here it's easy to fix for Zig master while still
supporting Zig 0.11.0. At the time of writing, with this commit, every
exercise test file on the track works with the latest Zig master
release.
  • Loading branch information
yctai1994 committed Jan 8, 2024
1 parent c7a723b commit c531537
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion exercises/practice/linked-list/test_linked_list.zig
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ test "pop, push, shift, and unshift can be used in any order" {
}

test "count an empty list" {
var list = List{};
const list = List{};
try testing.expectEqual(@as(usize, 0), list.len);
}

Expand Down

0 comments on commit c531537

Please sign in to comment.