Skip to content

Commit

Permalink
FIX: TAKE/part of offset gob! returning contents from head of gob!
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Sep 14, 2022
1 parent 22b8224 commit 2f601ff
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/t-gob.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ const REBCNT Gob_Flag_Words[] = {
ser = Make_Block(len);
ser->tail = len;
val = BLK_HEAD(ser);
gp = GOB_HEAD(gob);
gp = GOB_SKIP(gob, index);
for (; len > 0; len--, val++, gp++) {
SET_GOB(val, *gp);
}
Expand Down
28 changes: 28 additions & 0 deletions src/tests/units/gob-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,34 @@ Rebol [
;@@ https://github.com/Oldes/Rebol-issues/issues/1490
--assert not equal? (make gob! []) (make gob! []) ; not equal by design

--test-- "take gob"
;@@ https://github.com/Oldes/Rebol-issues/issues/1797
g: make gob! []
a: make gob! [text: "A"]
b: make gob! [text: "B"]
c: make gob! [text: "C"]
clear g repend g [a b c]
--assert all [
1 = index? g
b = take next g
1 = index? g
2 = length? g
]
--assert all [
c = first take/part next g 1
1 = index? g
1 = length? g
]
--assert none? take tail g

clear g repend g [a b c]
--assert all [
(reduce [b c]) = take/part next g 10
1 = index? g
1 = length? g
]


===end-group===

~~~end-file~~~
Expand Down

0 comments on commit 2f601ff

Please # to comment.