Created
October 25, 2014 15:44
-
-
Save stefan991/9f52d2433baf39f6146c to your computer and use it in GitHub Desktop.
Debugging buffer_spec.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c | |
index b76bad6..a7427c0 100644 | |
--- a/src/nvim/buffer.c | |
+++ b/src/nvim/buffer.c | |
@@ -1418,6 +1418,9 @@ buflist_new ( | |
lastbuf = buf; | |
buf->b_fnum = top_file_num++; | |
+ printf("\n c: buf->b_fnum:\t%d\n", buf->b_fnum); | |
+ printf("\n c: offset of b_fnum:\t%lu\n", | |
+ offsetof(struct file_buffer, b_fnum)); | |
if (top_file_num < 0) { /* wrap around (may cause duplicates) */ | |
EMSG(_("W14: Warning: List of file names overflow")); | |
if (emsg_silent == 0) { | |
diff --git a/test/unit/buffer_spec.lua b/test/unit/buffer_spec.lua | |
index 5244c2a..c0ff09e 100644 | |
--- a/test/unit/buffer_spec.lua | |
+++ b/test/unit/buffer_spec.lua | |
@@ -1,4 +1,5 @@ | |
local helpers = require("test.unit.helpers") | |
+local ffi = require('ffi') | |
local to_cstr = helpers.to_cstr | |
local eq = helpers.eq | |
@@ -13,7 +14,11 @@ describe('buffer functions', function() | |
local buflist_new = function(file, flags) | |
local c_file = to_cstr(file) | |
- return buffer.buflist_new(c_file, c_file, 1, flags) | |
+ local buf = buffer.buflist_new(c_file, c_file, 1, flags) | |
+ print("lua: buf->b_fnum:", buf.b_fnum) | |
+ print("lua: offset of b_fnum:", | |
+ ffi.offsetof("struct file_buffer", "b_fnum")) | |
+ return buf | |
end | |
local close_buffer = function(win, buf, action, abort_if_last) | |
@@ -92,6 +97,7 @@ describe('buffer functions', function() | |
close_buffer(NULL, buf, buffer.DOBUF_WIPE, 0) | |
end) | |
+ --[[ | |
it('should prefer to match the start of a file path', function() | |
local buf1 = buflist_new(path1, buffer.BLN_LISTED) | |
local buf2 = buflist_new(path2, buffer.BLN_LISTED) | |
@@ -207,5 +213,6 @@ describe('buffer functions', function() | |
close_buffer(NULL, buf1, buffer.DOBUF_WIPE, 0) | |
close_buffer(NULL, buf2, buffer.DOBUF_WIPE, 0) | |
end) | |
+ --]] | |
end) | |
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% make unittest | |
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C .deps/build/third-party | |
[ 22%] Built target libuv | |
[ 44%] Built target luajit | |
[ 66%] Built target luarocks | |
[ 88%] Built target msgpack | |
[ 91%] Built target busted | |
[ 94%] Built target lua-messagepack | |
[ 97%] Built target lpeg | |
[100%] Built target nvim-client | |
[100%] Built target third-party | |
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C build | |
[ 83%] Built target nvim | |
[ 83%] Built target sjiscorr | |
[100%] Built target translations | |
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C build unittest | |
[ 97%] Built target nvim-test | |
[100%] Built target unittest-headers | |
c: buf->b_fnum: 1 | |
c: offset of b_fnum: 192 | |
● | |
c: buf->b_fnum: 2 | |
c: offset of b_fnum: 192 | |
lua: buf->b_fnum: 67108864 | |
lua: offset of b_fnum: 181 | |
●lua: buf->b_fnum: 67108864 | |
lua: offset of b_fnum: 181 | |
●lua: buf->b_fnum: 67108864 | |
lua: offset of b_fnum: 181 | |
●lua: buf->b_fnum: 67108864 | |
lua: offset of b_fnum: 181 | |
● | |
c: buf->b_fnum: 3 | |
c: offset of b_fnum: 192 | |
lua: buf->b_fnum: 67108864 | |
lua: offset of b_fnum: 181 | |
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● | |
194 successes / 1 failure / 0 errors / 0 pending : 0.0 seconds | |
Failure → /Users/stefan/Dev/neovim/test/unit/buffer_spec.lua @ 92 | |
buffer functions buflist_findpat should find exact matches | |
/Users/stefan/Dev/neovim/test/unit/buffer_spec.lua:95: Expected objects to be the same. Passed in: | |
(number) 3 | |
Expected: | |
(number) 67108864 | |
stack traceback: | |
/Users/stefan/Dev/neovim/test/unit/buffer_spec.lua:92: in function </Users/stefan/Dev/neovim/test/unit/buffer_spec.lua:83> | |
CMake Error at /Users/stefan/Dev/neovim/cmake/RunTests.cmake:22 (message): | |
Unit tests failed. | |
make[4]: *** [CMakeFiles/unittest] Error 1 | |
make[3]: *** [CMakeFiles/unittest.dir/all] Error 2 | |
make[2]: *** [CMakeFiles/unittest.dir/rule] Error 2 | |
make[1]: *** [unittest] Error 2 | |
make: *** [unittest] Error 2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% make unittest | |
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C .deps/build/third-party | |
[ 22%] Built target libuv | |
[ 44%] Built target luajit | |
[ 66%] Built target luarocks | |
[ 88%] Built target msgpack | |
[ 91%] Built target busted | |
[ 94%] Built target lua-messagepack | |
[ 97%] Built target lpeg | |
[100%] Built target nvim-client | |
[100%] Built target third-party | |
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C build | |
[ 0%] Generating auto/buffer.c.generated.h, ../../include/buffer.h.generated.h | |
Scanning dependencies of target nvim | |
[ 2%] Building C object src/nvim/CMakeFiles/nvim.dir/buffer.c.o | |
Linking C executable ../../bin/nvim | |
[100%] Built target nvim | |
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C build unittest | |
[ 1%] Built target unittest-headers | |
Scanning dependencies of target nvim-test | |
[ 1%] Building C object src/nvim/CMakeFiles/nvim-test.dir/buffer.c.o | |
Linking C shared module libnvim-test.so | |
[100%] Built target nvim-test | |
c: buf->b_fnum: 1 | |
c: offset of b_fnum: 192 | |
● | |
c: buf->b_fnum: 2 | |
c: offset of b_fnum: 192 | |
lua: buf->b_fnum: 2 | |
lua: offset of b_fnum: 192 | |
●lua: buf->b_fnum: 2 | |
lua: offset of b_fnum: 192 | |
●lua: buf->b_fnum: 2 | |
lua: offset of b_fnum: 192 | |
●lua: buf->b_fnum: 2 | |
lua: offset of b_fnum: 192 | |
● | |
c: buf->b_fnum: 3 | |
c: offset of b_fnum: 192 | |
lua: buf->b_fnum: 3 | |
lua: offset of b_fnum: 192 | |
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●ERROR: helpers.lua: Preprocess.preprocess_stream():read() returned empty | |
●ERROR: helpers.lua: Preprocess.preprocess_stream():read() returned empty | |
●ERROR: helpers.lua: Preprocess.preprocess_stream():read() returned empty | |
● | |
122 successes / 0 failures / 3 errors / 0 pending : 0.0 seconds | |
Error → ./test/unit/formatc.lua:158: bad argument #2 to 'TokeniseC' (string expected, got nil) | |
stack traceback: | |
Error → ./test/unit/formatc.lua:158: bad argument #2 to 'TokeniseC' (string expected, got nil) | |
stack traceback: | |
Error → ./test/unit/formatc.lua:158: bad argument #2 to 'TokeniseC' (string expected, got nil) | |
stack traceback: | |
CMake Error at /Users/stefan/Dev/neovim/cmake/RunTests.cmake:22 (message): | |
Unit tests failed. | |
make[4]: *** [CMakeFiles/unittest] Error 1 | |
make[3]: *** [CMakeFiles/unittest.dir/all] Error 2 | |
make[2]: *** [CMakeFiles/unittest.dir/rule] Error 2 | |
make[1]: *** [unittest] Error 2 | |
make: *** [unittest] Error 2 | |
stefan at imac in ~/Dev/neovim on git:master+ | |
% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment