Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Add tests for types in impl statements (closes #7, implemented by #96)
Browse files Browse the repository at this point in the history
  • Loading branch information
zargony committed Jun 27, 2017
1 parent d4a0a7f commit 3da5c74
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions spec/rust-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -652,3 +652,20 @@ describe 'Rust grammar', ->
expect(tokens[2]).toEqual value: 'priv', scopes: ['source.rust', 'invalid.deprecated.rust']
expect(tokens[4]).toEqual value: '=', scopes: ['source.rust', 'keyword.operator.assignment.rust']
expect(tokens[6]).toEqual value: '10', scopes: ['source.rust', 'constant.numeric.integer.decimal.rust']

it 'tokenizes types in `impl` statements correctly (issue \\#7)', ->
tokens = grammar.tokenizeLines('''
struct MyObject<'a> {
mystr: &'a str
}
impl<'a> MyObject<'a> {
fn print(&self) {}
}
impl<'a> Clone for MyObject<'a> {
fn clone(&self) {}
}
''')
expect(tokens[0][2]).toEqual value: 'MyObject', scopes: ['source.rust', 'entity.name.type.rust']
expect(tokens[3][6]).toEqual value: 'MyObject', scopes: ['source.rust', 'entity.name.type.rust']
expect(tokens[6][6]).toEqual value: 'Clone', scopes: ['source.rust', 'support.type.core.rust']
expect(tokens[6][10]).toEqual value: 'MyObject', scopes: ['source.rust', 'entity.name.type.rust']

0 comments on commit 3da5c74

Please sign in to comment.