1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 12:50:03 +08:00
SpaceVim/bundle/splitjoin.vim/spec/plugin/clojure_spec.rb

77 lines
1.6 KiB
Ruby
Raw Normal View History

2024-06-27 18:10:36 +08:00
require 'spec_helper'
describe "clojure" do
let(:filename) { 'test.clj' }
specify "Lists with ([ brackets" do
set_file_contents "(dispatch [::events/insert-staff-entry day-ord shift unit @why @who])"
vim.search 'dispatch'
split
assert_file_contents <<~EOF
(dispatch
[::events/insert-staff-entry day-ord shift unit @why @who])
EOF
join
assert_file_contents <<~EOF
(dispatch [::events/insert-staff-entry day-ord shift unit @why @who])
EOF
vim.search 'day-ord'
split
assert_file_contents <<~EOF
(dispatch [::events/insert-staff-entry
day-ord
shift
unit
@why
@who])
EOF
join
assert_file_contents <<~EOF
(dispatch [::events/insert-staff-entry day-ord shift unit @why @who])
EOF
end
specify "Dictionaries" do
set_file_contents '#{:a :b :c :d}'
vim.search ':b'
split
assert_file_contents <<~'EOF'
#{:a
:b
:c
:d}
EOF
join
assert_file_contents '#{:a :b :c :d}'
end
specify "Doesn't get confused with brackets in strings" do
set_file_contents '(map (fn [x] (.toUpperCase x)) (.split "Dasher Dancer) Prancer" " "))'
vim.search 'Dancer'
split
assert_file_contents <<~EOF
(map (fn [x] (.toUpperCase x)) (.split
"Dasher Dancer) Prancer"
" "))
EOF
join
assert_file_contents '(map (fn [x] (.toUpperCase x)) (.split "Dasher Dancer) Prancer" " "))'
end
end