File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
require 'spec_helper'
4
4
5
+ describe 'defguard syntax' do
6
+ it 'defines `defguard` keyword as elixirGuard' do
7
+ expect ( <<~EOF ) . to include_elixir_syntax ( 'elixirGuard' , 'defguard' )
8
+ defguard some_guard(x) when is_integer(x)
9
+ EOF
10
+ end
11
+
12
+ it 'defines `defguardp` keyword as elixirPrivateGuard' do
13
+ expect ( <<~EOF ) . to include_elixir_syntax ( 'elixirPrivateGuard' , 'defguardp' )
14
+ defguardp some_private_guard(x) when is_integer(x)
15
+ EOF
16
+ end
17
+ end
18
+
5
19
describe 'Guard syntax' do
6
20
it 'guard in function' do
7
21
expect ( <<~EOF ) . to include_elixir_syntax ( 'elixirKernelFunction' , 'is_atom' )
Original file line number Diff line number Diff line change @@ -141,6 +141,8 @@ syn region elixirDocString matchgroup=elixirSigilDelimiter start=+\%(@\w*doc\s\
141
141
" Defines
142
142
syn match elixirDefine ' \< def\>\( :\)\@ !' nextgroup =elixirFunctionDeclaration skipwhite skipnl
143
143
syn match elixirPrivateDefine ' \< defp\>\( :\)\@ !' nextgroup =elixirFunctionDeclaration skipwhite skipnl
144
+ syn match elixirGuard ' \< defguard\>\( :\)\@ !' nextgroup =elixirFunctionDeclaration skipwhite skipnl
145
+ syn match elixirPrivateGuard ' \< defguardp\>\( :\)\@ !' nextgroup =elixirFunctionDeclaration skipwhite skipnl
144
146
syn match elixirModuleDefine ' \< defmodule\>\( :\)\@ !' nextgroup =elixirModuleDeclaration skipwhite skipnl
145
147
syn match elixirProtocolDefine ' \< defprotocol\>\( :\)\@ !' nextgroup =elixirProtocolDeclaration skipwhite skipnl
146
148
syn match elixirImplDefine ' \< defimpl\>\( :\)\@ !' nextgroup =elixirImplDeclaration skipwhite skipnl
@@ -175,6 +177,8 @@ syn match elixirExUnitAssert "\(^\s*\)\@<=\<\(catch_exit\|catch_throw\|flunk\|r
175
177
hi def link elixirBlockDefinition Keyword
176
178
hi def link elixirDefine Define
177
179
hi def link elixirPrivateDefine Define
180
+ hi def link elixirGuard Define
181
+ hi def link elixirPrivateGuard Define
178
182
hi def link elixirModuleDefine Define
179
183
hi def link elixirProtocolDefine Define
180
184
hi def link elixirImplDefine Define
You can’t perform that action at this time.
0 commit comments