From 6f6d834d980644d7c8e33fdec1c54d04e4a98d39 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 10 Sep 2022 20:40:08 +0800 Subject: [PATCH] test(java): fix java layer test --- lua/spacevim/layer/lang/java.lua | 5 +++-- test/lua/layer/lang/java.vader | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lua/spacevim/layer/lang/java.lua b/lua/spacevim/layer/lang/java.lua index 363b3bea2..860e667cd 100644 --- a/lua/spacevim/layer/lang/java.lua +++ b/lua/spacevim/layer/lang/java.lua @@ -22,8 +22,9 @@ end function M.set_variable(var) - format_on_save = var.format_on_save or format_on_save - + if var.format_on_save ~= nil then + format_on_save = var.format_on_save + end end diff --git a/test/lua/layer/lang/java.vader b/test/lua/layer/lang/java.vader index eae923c4b..d08f83076 100644 --- a/test/lua/layer/lang/java.vader +++ b/test/lua/layer/lang/java.vader @@ -1,7 +1,8 @@ Execute ( SpaceVim lua layer: lang#java ): if has('nvim-0.5.0') || has('+lua') - lua require('spacevim.layer.lang.java').set_variable({['format_on_save'] = false}) - lua format_on_save = require('spacevim.layer.lang.java').get_variable() + let cmp = SpaceVim#api#import('vim#compatible') + lua require('spacevim.layer.lang.java').set_variable({format_on_save = false}) + lua format_on_save = require('spacevim.layer.lang.java').get_variable().format_on_save AssertEqual cmp.luaeval('format_on_save'), v:false endif