【发布时间】:2016-09-25 03:04:08
【问题描述】:
继我之前的问题here 之后,我正在尝试获取由 Atom 注册的“规范”文件,我已经成功了,但是现在,无论有多少 describe 和 it 我做,当我测试它时它什么也没做。
我使用命令apm test,得到的只是:
[655:0527/083825:WARNING:resource_bundle.cc(305)] locale_file_path.empty() for locale English
[655:0527/083825:ERROR:file_io.cc(30)] read: expected 40, observed 0
[659:0527/083825:WARNING:resource_bundle.cc(305)] locale_file_path.empty() for locale English
[655:0527/083828:INFO:CONSOLE(52)] "Window load time: 2420ms", source: file:///Applications/Atom.app/Contents/Resources/app.asar/static/index.js (52)
Finished in 0.023 seconds
0 tests, 0 assertions, 0 failures, 0 skipped
Tests passed
根据规范文件(肯定被注册,因为它在不存在时会抱怨)判断,我应该运行 3 个测试。
我的规范文件如下...(语法荧光笔包)
describe "Jazz grammar", ->
grammar = null
beforeEach ->
waitsForPromise ->
atom.packages.activatePackage("language-jazz")
runs ->
grammar = atom.grammars.grammarForScopeName("source.jazz")
it "parses the grammar", ->
expect(grammar).toBeDefined()
expect(grammar.scopeName).toBe "source.jazz"
it "tokenises keywords", ->
tokens = grammar.tokenizeLines('func')
expect(tokens[0][0].value).toBe 'func'
expect(tokens[0][0].scopes).toEqual ['source.jazz', 'storage.type.jazz']
it "tokenizes comments inside function parameters", ->
tokens = grammar.tokenizeLines('module test(arg1, ;; arg2)')
expect(tokens[0][0].value).toBe 'module'
expect(tokens[0][0].scopes).toEqual ['source.jazz', 'storage.type.jazz']
expect(tokens[0][1].scopes).toEqual ['source.jazz', 'comment.line.jazz']
我的文件结构如下:
- 语言-爵士
- 语法
jazz.cson
- sn-ps
language-jazz.cson
- 规格
jazz-spec.coffee
package.json- 其他 GitHub 和 Travis CI 资料。
- 语法
【问题讨论】:
标签: coffeescript jasmine atom-editor