dotfiles/vim/plugins/vim-elixir-master/spec/syntax/list_spec.rb
Jeff Clement 931e9d4aee
mise++
2025-03-08 20:32:06 -07:00

40 lines
1,009 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
describe 'List syntax' do
it 'should properly handle "\\\\" inside' do
syntax = <<~EOF
'"\\\\'
var = 1
EOF
expect(syntax).to include_elixir_syntax('elixirId', 'var')
expect(syntax).not_to include_elixir_syntax('elixirString', 'var')
end
it 'recognizes lists' do
syntax = <<~EOF
[
:hello,
:world
]
EOF
expect(syntax).to include_elixir_syntax('elixirListDelimiter', '[')
expect(syntax).to include_elixir_syntax('elixirList', ':hello')
expect(syntax).to include_elixir_syntax('elixirListDelimiter', ']')
end
it 'recognizes lists inside functions' do
syntax = <<~EOF
def hello_world do
[
:hello,
:world
]
end
EOF
expect(syntax).to include_elixir_syntax('elixirListDelimiter', '[')
expect(syntax).to include_elixir_syntax('elixirList', ':hello')
expect(syntax).to include_elixir_syntax('elixirListDelimiter', ']')
end
end