Mercurial > vim
annotate src/testdir/test_largefile.vim @ 17262:041156ce1d22 v8.1.1630
patch 8.1.1630: various small problems
commit https://github.com/vim/vim/commit/e809a4ed3014fbf717c936c727291b5f038829a5
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 4 17:35:05 2019 +0200
patch 8.1.1630: various small problems
Problem: Various small problems.
Solution: Various small improvements.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 04 Jul 2019 17:45:04 +0200 |
parents | c4aae9421aec |
children | fdfe44ac6a1a |
rev | line source |
---|---|
9387
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for large files |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 " This is only executed manually: "make test_largefile". |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 " This is not run as part of "make test". |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 func Test_largefile() |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 let fname = 'Xlarge.txt' |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call delete(fname) |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 exe "e" fname |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 " Make sure that a line break is 1 byte (LF). |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 set ff=unix |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 set undolevels=-1 |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 " Input 99 'A's. The line becomes 100 bytes including a line break. |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 exe "normal 99iA\<Esc>" |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 yank |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 " Put 39,999,999 times. The file becomes 4,000,000,000 bytes. |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 normal 39999999p |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 " Moving around in the file randomly. |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 normal G |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 normal 10% |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 normal 90% |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 normal 50% |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 normal gg |
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 w |
9393
c4aae9421aec
commit https://github.com/vim/vim/commit/c5af40ae646ceda817eff93b4f9ba274f031bea6
Christian Brabandt <cb@256bit.org>
parents:
9387
diff
changeset
|
25 " Check if the file size is 4,000,000,000 bytes. |
9387
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 let fsize=getfsize(fname) |
9393
c4aae9421aec
commit https://github.com/vim/vim/commit/c5af40ae646ceda817eff93b4f9ba274f031bea6
Christian Brabandt <cb@256bit.org>
parents:
9387
diff
changeset
|
27 if has('num64') |
c4aae9421aec
commit https://github.com/vim/vim/commit/c5af40ae646ceda817eff93b4f9ba274f031bea6
Christian Brabandt <cb@256bit.org>
parents:
9387
diff
changeset
|
28 call assert_true(fsize == 4000000000) |
c4aae9421aec
commit https://github.com/vim/vim/commit/c5af40ae646ceda817eff93b4f9ba274f031bea6
Christian Brabandt <cb@256bit.org>
parents:
9387
diff
changeset
|
29 else |
c4aae9421aec
commit https://github.com/vim/vim/commit/c5af40ae646ceda817eff93b4f9ba274f031bea6
Christian Brabandt <cb@256bit.org>
parents:
9387
diff
changeset
|
30 " getfsize() returns -2 if a Number is 32 bits. |
c4aae9421aec
commit https://github.com/vim/vim/commit/c5af40ae646ceda817eff93b4f9ba274f031bea6
Christian Brabandt <cb@256bit.org>
parents:
9387
diff
changeset
|
31 call assert_true(fsize == -2) |
c4aae9421aec
commit https://github.com/vim/vim/commit/c5af40ae646ceda817eff93b4f9ba274f031bea6
Christian Brabandt <cb@256bit.org>
parents:
9387
diff
changeset
|
32 endif |
c4aae9421aec
commit https://github.com/vim/vim/commit/c5af40ae646ceda817eff93b4f9ba274f031bea6
Christian Brabandt <cb@256bit.org>
parents:
9387
diff
changeset
|
33 call delete(fname) |
9387
f094d4085014
commit https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 endfunc |