Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: consistent boolean options #947

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gepbird
Copy link
Contributor

@gepbird gepbird commented Jul 19, 2024

Breakdown of #922.

In general a lot of the attempts to add booleans and things like that are actually contrary to my intentions. The reason I added them like that was actually to specifically discourage copy-pasting which ends up being a huge cause of issues for me since if the code is clearly not copy-pastable people tend to add things in themselves rather than copy a huge blob then complain it doesn't work as they expect

Instead of removing 2nd boolean options, I added them to discourage people from copy pasting this into their config. I'm fine with either removing or adding these, I'd just like to have the same style everywhere across this project :)

@gepbird
Copy link
Contributor Author

gepbird commented Jul 19, 2024

Unrelated to this PR, but

  1. How can I run the tests locally? I tried the command from CI, but it doesn't find tests.utils module :/
output of test command
bufferline.nvim ❯ nvim --headless -u tests/minimal_init.lua -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/minimal_init.lua', sequential = true}"

Installing nvim-lua/plenary.nvim
Installing nvim-tree/nvim-web-devicons
Starting...Scheduling: tests/bufferline_spec.lua
Scheduling: tests/colors_spec.lua
Error detected while processing command line:
E5108: Error executing lua ...site/pack/deps/start/plenary.nvim/lua/plenary/busted.lua:268: /home/gep/bufferline.nvim/tests/bufferline_spec.lua:1: module 'tests.utils' not found:
        no field package.preload['tests.utils']
        no file '/nix/store/q4jr305if128xvdv5826drpwymharss0-lua5.1-jsregexp-0.0.7-1/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/6515z9pwf0jyz2qiid5j13994xms163c-lua5.1-luassert-1.9.0-1/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/6515z9pwf0jyz2qiid5j13994xms163c-lua5.1-luassert-1.9.0-1/share/lua/5.1/tests/utils/init.lua'
        no file '/nix/store/01rhx6gr1km02m2gfc4ihvwsbmz7l0hf-lua5.1-say-1.4.1-3/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/01rhx6gr1km02m2gfc4ihvwsbmz7l0hf-lua5.1-say-1.4.1-3/share/lua/5.1/tests/utils/init.lua'
        no file '/nix/store/x51hbr424gj7j0930ymyhcws34iy573h-lua5.1-plenary.nvim-scm-1/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/x51hbr424gj7j0930ymyhcws34iy573h-lua5.1-plenary.nvim-scm-1/share/lua/5.1/tests/utils/init.lua'
        no file '/nix/store/w8n3hig490jyfjz7c9qnjaxv8jzdjhkw-luajit-2.1.1713773202-env/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/w8n3hig490jyfjz7c9qnjaxv8jzdjhkw-luajit-2.1.1713773202-env/share/lua/5.1/tests/utils/init.lua'
        no file '/nix/store/q4jr305if128xvdv5826drpwymharss0-lua5.1-jsregexp-0.0.7-1/lib/lua/5.1/tests/utils.so'
        no file '/nix/store/w8n3hig490jyfjz7c9qnjaxv8jzdjhkw-luajit-2.1.1713773202-env/lib/lua/5.1/tests/utils.so'
        no file '/nix/store/q4jr305if128xvdv5826drpwymharss0-lua5.1-jsregexp-0.0.7-1/lib/lua/5.1/tests.so'
        no file '/nix/store/w8n3hig490jyfjz7c9qnjaxv8jzdjhkw-luajit-2.1.1713773202-env/lib/lua/5.1/tests.so'
stack traceback:
        [builtin#36]: at 0x7f63773d8e00
        ...site/pack/deps/start/plenary.nvim/lua/plenary/busted.lua:268: in function 'run'
        [string ":lua"]:1: in main chunkVim: Caught deadly signal 'SIGTERM'

Vim: Finished.

========================================
Testing:        /home/gep/bufferline.nvim/tests/bufferline_spec.lua
Scheduling: tests/config_spec.lua

========================================
Testing:        /home/gep/bufferline.nvim/tests/colors_spec.lua
Success ||      Colors: get_color -  should correctly derive normal color
Success ||      Colors: get_color -  should use fallback if main is unavailable
Success ||      Colors: get_color -  should use fallbacks recursively
Success ||      Colors: get_color -  should not return a value if it set to not_match

Success:        4
Failed :        0
Errors :        0
========================================
Scheduling: tests/custom_area_spec.lua

========================================
Testing:        /home/gep/bufferline.nvim/tests/config_spec.lua
Success ||      Config tests Setting config should add defaults to user values
Success ||      Config tests Setting config should derive colors from the existing highlights
Success ||      Config tests Setting config should not underline anything if options.indicator.style = "icon"
Success ||      Config tests Setting config should only underline valid fields if options.indicator.style = "underline"
Success ||      Config tests Setting config - Style Presets -  should disable all bolding if the preset contains no bold
Success ||      Config tests Setting config - Style Presets -  should disable all italics if the preset contains no italic
Success ||      Config tests Setting config - Style Presets -  should disable both italics and bold, if no_bold and no_italic are specified
Success ||      Config tests Resetting config - should use updated colors when the colorscheme changes

Success:        8
Failed :        0
Errors :        0
========================================
Scheduling: tests/duplicates_spec.lua

========================================
Testing:        /home/gep/bufferline.nvim/tests/custom_area_spec.lua
Success ||      Custom areas - should generate a custom area from config
Success ||      Custom areas - should handle sides correctly
Success ||      Custom areas - should handle user errors gracefully

Success:        3
Failed :        0
Errors :        0
========================================
Scheduling: tests/groups_spec.lua

========================================
Testing:        /home/gep/bufferline.nvim/tests/duplicates_spec.lua
Success ||      Duplicate Tests -  should mark duplicate files
Success ||      Duplicate Tests -  should show duplicates across groups
Success ||      Duplicate Tests -  should not show duplicates across groups
Success ||      Duplicate Tests -  should return the correct prefix count
Success ||      Duplicate Tests -  should indicate if a buffer is exactly the same as another
Success ||      Duplicate Tests -  should return a prefixed element if duplicated
Success ||      Duplicate Tests -  should truncate a very long directory name

Success:        7
Failed :        0
Errors :        0
========================================
Scheduling: tests/highlights_spec.lua
Error detected while processing command line:
E5108: Error executing lua ...site/pack/deps/start/plenary.nvim/lua/plenary/busted.lua:268: /home/gep/bufferline.nvim/tests/groups_spec.lua:1: module 'tests.utils' not found:
        no field package.preload['tests.utils']
        no file '/nix/store/q4jr305if128xvdv5826drpwymharss0-lua5.1-jsregexp-0.0.7-1/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/6515z9pwf0jyz2qiid5j13994xms163c-lua5.1-luassert-1.9.0-1/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/6515z9pwf0jyz2qiid5j13994xms163c-lua5.1-luassert-1.9.0-1/share/lua/5.1/tests/utils/init.lua'
        no file '/nix/store/01rhx6gr1km02m2gfc4ihvwsbmz7l0hf-lua5.1-say-1.4.1-3/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/01rhx6gr1km02m2gfc4ihvwsbmz7l0hf-lua5.1-say-1.4.1-3/share/lua/5.1/tests/utils/init.lua'
        no file '/nix/store/x51hbr424gj7j0930ymyhcws34iy573h-lua5.1-plenary.nvim-scm-1/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/x51hbr424gj7j0930ymyhcws34iy573h-lua5.1-plenary.nvim-scm-1/share/lua/5.1/tests/utils/init.lua'
        no file '/nix/store/w8n3hig490jyfjz7c9qnjaxv8jzdjhkw-luajit-2.1.1713773202-env/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/w8n3hig490jyfjz7c9qnjaxv8jzdjhkw-luajit-2.1.1713773202-env/share/lua/5.1/tests/utils/init.lua'
        no file '/nix/store/q4jr305if128xvdv5826drpwymharss0-lua5.1-jsregexp-0.0.7-1/lib/lua/5.1/tests/utils.so'
        no file '/nix/store/w8n3hig490jyfjz7c9qnjaxv8jzdjhkw-luajit-2.1.1713773202-env/lib/lua/5.1/tests/utils.so'
        no file '/nix/store/q4jr305if128xvdv5826drpwymharss0-lua5.1-jsregexp-0.0.7-1/lib/lua/5.1/tests.so'
        no file '/nix/store/w8n3hig490jyfjz7c9qnjaxv8jzdjhkw-luajit-2.1.1713773202-env/lib/lua/5.1/tests.so'
stack traceback:
        [builtin#36]: at 0x7fa722bebe00
        ...site/pack/deps/start/plenary.nvim/lua/plenary/busted.lua:268: in function 'run'
        [string ":lua"]:1: in main chunkVim: Caught deadly signal 'SIGTERM'

Vim: Finished.

========================================
Testing:        /home/gep/bufferline.nvim/tests/groups_spec.lua
Scheduling: tests/numbers_spec.lua

========================================
Testing:        /home/gep/bufferline.nvim/tests/highlights_spec.lua
Success ||      Highlights - should set highlights as default
Success ||      Highlights - should not set highlights as default if themable = false

Success:        2
Failed :        0
Errors :        0
========================================
Scheduling: tests/offset_spec.lua

========================================
Testing:        /home/gep/bufferline.nvim/tests/numbers_spec.lua
Success ||      Number tests:  should return an ordinal in the default style
Success ||      Number tests:  should return a buffer id in the default style
Success ||      Number tests:  should return the correct default for both style
Success ||      Number tests:  should handle a custom numbers function
Success ||      Number tests:  should return two superscript numbers

Success:        5
Failed :        0
Errors :        0
========================================
Scheduling: tests/sorters_spec.lua

========================================
Testing:        /home/gep/bufferline.nvim/tests/offset_spec.lua
Success ||      Offset tests: should not trigger if no offsets are specified
Success ||      Offset tests: should create an offset if a compatible panel if open
Success ||      Offset tests: should include padded text if text is specified
Success ||      Offset tests: should add the offset to the correct side
Success ||      Offset tests: should correctly truncate offset text
Success ||      Offset tests: should allow left and right offsets
Success ||      Offset tests: should allow setting some extra padding
Success ||      Offset tests: should align the text to the right if specified
Success ||      Offset tests: should align the text to the left if specified
Success ||      Offset tests: should handle a vertical panel with horizontal splits inside it

Success:        10
Failed :        0
Errors :        0
========================================
Scheduling: tests/ui_spec.lua

========================================
Testing:        /home/gep/bufferline.nvim/tests/sorters_spec.lua
Success ||      Sorters -  should always return a list
Success ||      Sorters -  should return an unsorted list sort is none
Success ||      Sorters -  should sort by ID correctly
Success ||      Sorters -  should sort by components correctly
Success ||      Sorters -  should add to the end of the buffer list
Success ||      Sorters -  should open the new buffer beside the current

Success:        6
Failed :        0
Errors :        0
========================================
Scheduling: tests/utils_spec.lua
Error detected while processing command line:
E5108: Error executing lua ...site/pack/deps/start/plenary.nvim/lua/plenary/busted.lua:268: /home/gep/bufferline.nvim/tests/ui_spec.lua:2: module 'tests.utils' not found:
        no field package.preload['tests.utils']
        no file '/nix/store/q4jr305if128xvdv5826drpwymharss0-lua5.1-jsregexp-0.0.7-1/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/6515z9pwf0jyz2qiid5j13994xms163c-lua5.1-luassert-1.9.0-1/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/6515z9pwf0jyz2qiid5j13994xms163c-lua5.1-luassert-1.9.0-1/share/lua/5.1/tests/utils/init.lua'
        no file '/nix/store/01rhx6gr1km02m2gfc4ihvwsbmz7l0hf-lua5.1-say-1.4.1-3/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/01rhx6gr1km02m2gfc4ihvwsbmz7l0hf-lua5.1-say-1.4.1-3/share/lua/5.1/tests/utils/init.lua'
        no file '/nix/store/x51hbr424gj7j0930ymyhcws34iy573h-lua5.1-plenary.nvim-scm-1/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/x51hbr424gj7j0930ymyhcws34iy573h-lua5.1-plenary.nvim-scm-1/share/lua/5.1/tests/utils/init.lua'
        no file '/nix/store/w8n3hig490jyfjz7c9qnjaxv8jzdjhkw-luajit-2.1.1713773202-env/share/lua/5.1/tests/utils.lua'
        no file '/nix/store/w8n3hig490jyfjz7c9qnjaxv8jzdjhkw-luajit-2.1.1713773202-env/share/lua/5.1/tests/utils/init.lua'
        no file '/nix/store/q4jr305if128xvdv5826drpwymharss0-lua5.1-jsregexp-0.0.7-1/lib/lua/5.1/tests/utils.so'
        no file '/nix/store/w8n3hig490jyfjz7c9qnjaxv8jzdjhkw-luajit-2.1.1713773202-env/lib/lua/5.1/tests/utils.so'
        no file '/nix/store/q4jr305if128xvdv5826drpwymharss0-lua5.1-jsregexp-0.0.7-1/lib/lua/5.1/tests.so'
        no file '/nix/store/w8n3hig490jyfjz7c9qnjaxv8jzdjhkw-luajit-2.1.1713773202-env/lib/lua/5.1/tests.so'
stack traceback:
        [builtin#36]: at 0x7f841de5de00
        ...site/pack/deps/start/plenary.nvim/lua/plenary/busted.lua:268: in function 'run'
        [string ":lua"]:1: in main chunkVim: Caught deadly signal 'SIGTERM'

Vim: Finished.

========================================
Testing:        /home/gep/bufferline.nvim/tests/ui_spec.lua

========================================
Testing:        /home/gep/bufferline.nvim/tests/utils_spec.lua
Success ||      Utils tests should correctly truncate a long name
Success ||      Utils tests should prefer dropping a filename extension in order to meet word limit
Success ||      Utils tests should prefer dropping a SINGLE filename extension in order to meet word limit
Success ||      Utils tests should save/restore positions correctly

Success:        4
Failed :        0
Errors :        0
========================================
  1. I'm asking you about the formatting of lua codes in the doc. Should I stick to the most common style and apply that to the docs and readme? Or should we format it with the project's stylua.toml? Or something different?

@gepbird gepbird mentioned this pull request Jul 20, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant