Skip to content

Commit cc3a6ca

Browse files
authored
Merge pull request #360 from elixir-lang/spec-helper
spec_helper: match syntax group exactly
2 parents 603a6fa + 67d8bb6 commit cc3a6ca

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

spec/spec_helper.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ def syntax(content, pattern)
5252
return []
5353
end
5454

55-
# Return the syntax groups in a list.
56-
@vim.echo <<~EOF
55+
syngroups = @vim.echo <<~EOF
5756
map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
5857
EOF
58+
59+
# From: "['elixirRecordDeclaration', 'elixirAtom']"
60+
# To: ["elixirRecordDeclaration", "elixirAtom"]
61+
syngroups.gsub!(/["'\[\]]/, '').split(', ')
5962
end
6063

6164
private

spec/syntax/sigil_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
end
9898

9999
it 'with escapes' do
100-
expect('~s(foo \n bar)').to include_elixir_syntax('elixirRegexEscape', '\\')
100+
expect('~s(foo \n bar)').to include_elixir_syntax('elixirRegexEscapePunctuation', '\\')
101101
end
102102

103103
it 'with interpolation' do
@@ -113,7 +113,7 @@
113113
end
114114

115115
it 'escapes with slashes' do
116-
expect('~s/foo \n bar/').to include_elixir_syntax('elixirRegexEscape', '\\')
116+
expect('~s/foo \n bar/').to include_elixir_syntax('elixirRegexEscapePunctuation', '\\')
117117
end
118118
end
119119
end

spec/syntax/struct_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
expect(str).to include_elixir_syntax('elixirStruct', 'name:')
3232

3333
expect(str).to include_elixir_syntax('elixirStructDelimiter', '}')
34-
expect(str).to include_elixir_syntax('elixirStruct', '}')
3534
end
3635

3736
it 'properly closes strings in structs' do
@@ -59,7 +58,6 @@
5958
expect(str).to include_elixir_syntax('elixirStruct', '"}')
6059

6160
expect(str).to include_elixir_syntax('elixirStructDelimiter', '} #')
62-
expect(str).to include_elixir_syntax('elixirStruct', '} #')
6361

6462
expect(str).to include_elixir_syntax('elixirComment', '# this should not be a string still')
6563
end

spec/syntax/tuple_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@
1313
expect(str).to include_elixir_syntax('elixirTuple', ':name')
1414

1515
expect(str).to include_elixir_syntax('elixirTupleDelimiter', '}')
16-
expect(str).to include_elixir_syntax('elixirTuple', '}')
1716
end
1817
end

0 commit comments

Comments
 (0)