@@ -21,12 +21,11 @@ subtest 'SeekFromBeginning' => {
21
21
$ fh . seek : 20 , SeekFromBeginning;
22
22
is-deeply $ fh . read (5 ). decode, ' ABCDE' , ' two successive seeks' ;
23
23
24
- # TODO XXX Currently throws just past beginning; Should it fail on both?
25
- # throws-like { $fh.seek: -300, SeekFromBeginning }, Exception,
26
- # 'seeking past beginning throws';
27
- #
28
- # throws-like { $fh.seek: 300, SeekFromBeginning }, Exception,
29
- # 'seeking past end throws';
24
+ $ fh . seek : 300 , SeekFromBeginning;
25
+ is $ fh . tell, 300 , ' seeking past end' ;
26
+
27
+ throws-like { $ fh . seek : -300 , SeekFromBeginning }, Exception ,
28
+ ' seeking past beginning throws' ;
30
29
}
31
30
32
31
subtest ' SeekFromCurrent' => {
@@ -51,14 +50,12 @@ subtest 'SeekFromCurrent' => {
51
50
$ fh . seek : -10 , SeekFromCurrent;
52
51
is-deeply $ fh . read (5 ). decode, ' abcde' , ' two successive seeks (neg, neg)' ;
53
52
54
- # TODO XXX Currently throws just past beginning; Should it fail on both?
55
- # throws-like { $fh.seek: - 300, SeekFromCurrent }, Exception,
56
- # 'seeking past beginning throws ';
53
+ $ fh . seek : 0 , SeekFromBeginning;
54
+ $ fh . seek : 300 , SeekFromCurrent;
55
+ is $ fh . tell, 300 , ' seeking past end ' ;
57
56
58
- # throws-like {
59
- # $fh.seek: 0, SeekFromBeginning;
60
- # $fh.seek: 300, SeekFromCurrent;
61
- # }, Exception, 'seeking past end throws';
57
+ throws-like { $ fh . seek : -3000 , SeekFromCurrent }, Exception ,
58
+ ' seeking past beginning throws' ;
62
59
}
63
60
64
61
subtest ' SeekFromEnd' => {
@@ -73,12 +70,11 @@ subtest 'SeekFromEnd' => {
73
70
$ fh . seek : -10 , SeekFromEnd;
74
71
is-deeply $ fh . read (5 ). decode, ' ABCDE' , ' two successive seeks' ;
75
72
76
- # TODO XXX Currently throws just past beginning; Should it fail on both?
77
- # throws-like { $fh.seek: -300, SeekFromEnd }, Exception,
78
- # 'seeking past beginning throws';
73
+ $ fh . seek : 300 , SeekFromEnd;
74
+ is $ fh . tell, 330 , ' seeking past end' ;
79
75
80
- # throws-like { $fh.seek: 300, SeekFromEnd }, Exception,
81
- # 'seeking past end throws';
76
+ throws-like { $ fh . seek : - 300 , SeekFromEnd }, Exception ,
77
+ ' seeking past beginning throws' ;
82
78
}
83
79
84
80
# vim: ft=perl6
0 commit comments