diff options
Diffstat (limited to 'doc/langref/test_pointer_arithmetic.zig')
| -rw-r--r-- | doc/langref/test_pointer_arithmetic.zig | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/doc/langref/test_pointer_arithmetic.zig b/doc/langref/test_pointer_arithmetic.zig index 14a90b7d03..2157428502 100644 --- a/doc/langref/test_pointer_arithmetic.zig +++ b/doc/langref/test_pointer_arithmetic.zig @@ -11,6 +11,9 @@ test "pointer arithmetic with many-item pointer" { // slicing a many-item pointer without an end is equivalent to // pointer arithmetic: `ptr[start..] == ptr + start` try expect(ptr[1..] == ptr + 1); + + // subtraction between any two pointers except slices based on element size is supported + try expect(&ptr[1] - &ptr[0] == 1); } test "pointer arithmetic with slices" { |
