aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/vlib/v/tests/array_of_alias_slice_test.v
diff options
context:
space:
mode:
Diffstat (limited to 'v_windows/v/old/vlib/v/tests/array_of_alias_slice_test.v')
-rw-r--r--v_windows/v/old/vlib/v/tests/array_of_alias_slice_test.v12
1 files changed, 12 insertions, 0 deletions
diff --git a/v_windows/v/old/vlib/v/tests/array_of_alias_slice_test.v b/v_windows/v/old/vlib/v/tests/array_of_alias_slice_test.v
new file mode 100644
index 0000000..d5f2716
--- /dev/null
+++ b/v_windows/v/old/vlib/v/tests/array_of_alias_slice_test.v
@@ -0,0 +1,12 @@
+type Ints = []int
+
+fn (i Ints) slice(to int) Ints {
+ return i[0..to]
+}
+
+fn test_array_of_alias_slice() {
+ values := Ints([5, 7, 9])
+
+ println(values.slice(2))
+ assert values.slice(2) == Ints([5, 7])
+}