diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/expectation.txt | 38 | ||||
-rw-r--r-- | test/print-trie.lua | 15 |
2 files changed, 22 insertions, 31 deletions
diff --git a/test/expectation.txt b/test/expectation.txt index da3deb6..0969608 100644 --- a/test/expectation.txt +++ b/test/expectation.txt @@ -1,28 +1,28 @@ -- vim:ft=lua -require("colorizer").attach_to_buffer(0, { css = true }) - +require("colorizer").detach_from_buffer(0) +require("colorizer").attach_to_buffer(0, { AARRGGBB = true, css = true, mode = "background" }) --[[ SUCCESS -#F0F -#FF00FF +0xFf32A14B 0xFf32A14B +#32a14b + +#F0F #FF00FF #FFF00F8F #F0F #FF00FF +#FF32A14B #FFF00F8F - #F0F - #FF00FF - #FFF00F8F - #F0F #F00 - #FF00FF #F00 - #FFF00F8F #F00 -Blue Gray LightBlue Gray100 White +#F0F #F00 +#FF00FF #F00 +#FFF00F8F #F00 + +blue gray lightblue gray100 white gold blue +Blue LightBlue Gray100 White White -#def -#deadbeef -rgba(200,30,0,0) -rgb(0,0,0) -rgb(10, 100 , 100) -hsl(300,50%,50%) -hsla(300,50%,50%,0.5) + +#def #deadbeef + +rgb(0,0,0) rgb(10, 100 , 100) +rgba(200,30,0,1) rgba(200,30,0,0.5) +hsl(300,50%,50%) hsla(300,50%,50%,0.5) hsla(300,50%,50%,1.0000000000000001) hsla(360,50%,50%,1.0000000000000001) -blue gray lightblue gray100 white gold blue ]] --[[ FAIL diff --git a/test/print-trie.lua b/test/print-trie.lua index 7575b5c..90017ad 100644 --- a/test/print-trie.lua +++ b/test/print-trie.lua @@ -1,14 +1,5 @@ --- TODO this is kinda shitty -local function dirname(str, sep) - sep = sep or "/" - return str:match("(.*" .. sep .. ")") -end - -local script_dir = dirname(arg[0]) -package.path = script_dir .. "/../lua/?.lua;" .. package.path - -local Trie = require "trie" -local nvim = require "nvim" +local Trie = require "colorizer.trie" +local color_map = vim.api.nvim_get_color_map local function print_color_trie() local tohex = bit.tohex @@ -20,7 +11,7 @@ local function print_color_trie() } local COLOR_MAP = {} local COLOR_TRIE = Trie() - for k, v in pairs(nvim.get_color_map()) do + for k, v in pairs(color_map()) do if not (COLOR_NAME_SETTINGS.strip_digits and k:match "%d+$") then COLOR_NAME_MINLEN = COLOR_NAME_MINLEN and min(#k, COLOR_NAME_MINLEN) or #k COLOR_NAME_MAXLEN = COLOR_NAME_MAXLEN and max(#k, COLOR_NAME_MAXLEN) or #k |