Skip to content

Commit

Permalink
Add test for sourcetext variation
Browse files Browse the repository at this point in the history
  • Loading branch information
keith committed Apr 28, 2017
1 parent 73d7083 commit e1a2ec6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/fixtures/sourcetext.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"key.offset": 0,
"key.length": 14,
"key.diagnostic_stage": "source.diagnostic.stage.swift.parse",
"key.syntaxmap": [
{
"key.kind": "source.lang.swift.syntaxtype.keyword",
"key.offset": 0,
"key.length": 6
},
{
"key.kind": "source.lang.swift.syntaxtype.identifier",
"key.offset": 7,
"key.length": 3
}
],
"key.substructure": [
{
"key.kind": "source.lang.swift.decl.struct",
"key.accessibility": "source.lang.swift.accessibility.internal",
"key.name": "Foo",
"key.offset": 0,
"key.length": 13,
"key.nameoffset": 7,
"key.namelength": 3,
"key.bodyoffset": 12,
"key.bodylength": 0
}
]
}
3 changes: 3 additions & 0 deletions tests/fixtures/valid_text_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
key.request: source.request.editor.open
key.name: "example.swift"
key.sourcetext: "struct Foo {}\n"
6 changes: 6 additions & 0 deletions tests/test_executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ def test_valid_request(self):
self.assertEqual(out, open("tests/fixtures/valid.json").read())
self.assertEqual(err, "")

def test_text_request(self):
code, out, err = run_command("tests/fixtures/valid_text_request.yaml")
self.assertEqual(code, 0)
self.assertEqual(out, open("tests/fixtures/sourcetext.json").read())
self.assertEqual(err, "")

def test_empty_argument(self):
code, out, err = run_command("")
self.assertEqual(code, 1)
Expand Down

0 comments on commit e1a2ec6

Please sign in to comment.