From f8f059d3fed05bcaf623d852ed6111f2e63d7a67 Mon Sep 17 00:00:00 2001 From: Corey Johnson & Kevin Sawicki Date: Wed, 29 May 2013 10:24:34 -0700 Subject: [PATCH] Use correct textmate package names --- spec/app/atom-spec.coffee | 12 ++-- spec/app/display-buffer-spec.coffee | 2 +- spec/app/edit-session-spec.coffee | 2 +- spec/app/editor-spec.coffee | 4 +- spec/app/language-mode-spec.coffee | 4 +- spec/app/syntax-spec.coffee | 10 +-- spec/app/text-mate-grammar-spec.coffee | 44 ++++++------ spec/app/tokenized-buffer-spec.coffee | 6 +- spec/fixtures/sample.plist | 71 +++++++++++++++++++ .../spec/grammar-selector-spec.coffee | 4 +- src/packages/link/spec/link-spec.coffee | 4 +- .../spec/markdown-preview-view-spec.coffee | 2 +- .../snippets/spec/snippets-spec.coffee | 4 +- .../spell-check/spec/spell-check-spec.coffee | 4 +- .../status-bar/spec/status-bar-spec.coffee | 4 +- 15 files changed, 124 insertions(+), 53 deletions(-) create mode 100644 spec/fixtures/sample.plist diff --git a/spec/app/atom-spec.coffee b/spec/app/atom-spec.coffee index e72499ca7..6738b2148 100644 --- a/spec/app/atom-spec.coffee +++ b/spec/app/atom-spec.coffee @@ -196,12 +196,12 @@ describe "the `atom` global", -> describe "textmate packages", -> it "loads the package's grammars", -> expect(syntax.selectGrammar("file.rb").name).toBe "Null Grammar" - atom.activatePackage('ruby.tmbundle', sync: true) + atom.activatePackage('ruby-tmbundle', sync: true) expect(syntax.selectGrammar("file.rb").name).toBe "Ruby" it "translates the package's scoped properties to Atom terms", -> expect(syntax.getProperty(['.source.ruby'], 'editor.commentStart')).toBeUndefined() - atom.activatePackage('ruby.tmbundle', sync: true) + atom.activatePackage('ruby-tmbundle', sync: true) expect(syntax.getProperty(['.source.ruby'], 'editor.commentStart')).toBe '# ' describe ".activatePackageConfig(id)", -> @@ -267,14 +267,14 @@ describe "the `atom` global", -> describe "texmate packages", -> it "removes the package's grammars", -> expect(syntax.selectGrammar("file.rb").name).toBe "Null Grammar" - atom.activatePackage('ruby.tmbundle', sync: true) + atom.activatePackage('ruby-tmbundle', sync: true) expect(syntax.selectGrammar("file.rb").name).toBe "Ruby" - atom.deactivatePackage('ruby.tmbundle') + atom.deactivatePackage('ruby-tmbundle') expect(syntax.selectGrammar("file.rb").name).toBe "Null Grammar" it "removes the package's scoped properties", -> - atom.activatePackage('ruby.tmbundle', sync: true) - atom.deactivatePackage('ruby.tmbundle') + atom.activatePackage('ruby-tmbundle', sync: true) + atom.deactivatePackage('ruby-tmbundle') expect(syntax.getProperty(['.source.ruby'], 'editor.commentStart')).toBeUndefined() describe ".getVersion(callback)", -> diff --git a/spec/app/display-buffer-spec.coffee b/spec/app/display-buffer-spec.coffee index fb98d6272..c02f334c6 100644 --- a/spec/app/display-buffer-spec.coffee +++ b/spec/app/display-buffer-spec.coffee @@ -6,7 +6,7 @@ describe "DisplayBuffer", -> [displayBuffer, buffer, changeHandler, tabLength] = [] beforeEach -> tabLength = 2 - atom.activatePackage('javascript.tmbundle', sync: true) + atom.activatePackage('javascript-tmbundle', sync: true) buffer = project.bufferForPath('sample.js') displayBuffer = new DisplayBuffer(buffer, { tabLength }) displayBuffer.on 'changed', changeHandler = jasmine.createSpy 'changeHandler' diff --git a/spec/app/edit-session-spec.coffee b/spec/app/edit-session-spec.coffee index 183a14310..3ed5238a4 100644 --- a/spec/app/edit-session-spec.coffee +++ b/spec/app/edit-session-spec.coffee @@ -9,7 +9,7 @@ describe "EditSession", -> buffer.setText(buffer.getText().replace(/[ ]{2}/g, "\t")) beforeEach -> - atom.activatePackage('javascript.tmbundle', sync: true) + atom.activatePackage('javascript-tmbundle', sync: true) editSession = project.open('sample.js', autoIndent: false) buffer = editSession.buffer lineLengths = buffer.getLines().map (line) -> line.length diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index 8cf8b30e8..19f7e4d0b 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -13,8 +13,8 @@ describe "Editor", -> [buffer, editor, editSession, cachedLineHeight, cachedCharWidth] = [] beforeEach -> - atom.activatePackage('text.tmbundle', sync: true) - atom.activatePackage('javascript.tmbundle', sync: true) + atom.activatePackage('text-tmbundle', sync: true) + atom.activatePackage('javascript-tmbundle', sync: true) editSession = project.open('sample.js') buffer = editSession.buffer editor = new Editor(editSession) diff --git a/spec/app/language-mode-spec.coffee b/spec/app/language-mode-spec.coffee index 662ebf182..adcd9b868 100644 --- a/spec/app/language-mode-spec.coffee +++ b/spec/app/language-mode-spec.coffee @@ -10,7 +10,7 @@ describe "LanguageMode", -> describe "javascript", -> beforeEach -> - atom.activatePackage('javascript.tmbundle', sync: true) + atom.activatePackage('javascript-tmbundle', sync: true) editSession = project.open('sample.js', autoIndent: false) { buffer, languageMode } = editSession @@ -88,7 +88,7 @@ describe "LanguageMode", -> describe "css", -> beforeEach -> - atom.activatePackage('css.tmbundle', sync: true) + atom.activatePackage('css-tmbundle', sync: true) editSession = project.open('css.css', autoIndent: false) { buffer, languageMode } = editSession diff --git a/spec/app/syntax-spec.coffee b/spec/app/syntax-spec.coffee index 6f5ece9df..50917c30c 100644 --- a/spec/app/syntax-spec.coffee +++ b/spec/app/syntax-spec.coffee @@ -2,10 +2,10 @@ fsUtils = require 'fs-utils' describe "the `syntax` global", -> beforeEach -> - atom.activatePackage('text.tmbundle', sync: true) - atom.activatePackage('javascript.tmbundle', sync: true) + atom.activatePackage('text-tmbundle', sync: true) + atom.activatePackage('javascript-tmbundle', sync: true) atom.activatePackage('coffee-script-tmbundle', sync: true) - atom.activatePackage('ruby.tmbundle', sync: true) + atom.activatePackage('ruby-tmbundle', sync: true) describe "serialization", -> it "remembers grammar overrides by path", -> @@ -18,7 +18,7 @@ describe "the `syntax` global", -> describe ".selectGrammar(filePath)", -> it "can use the filePath to load the correct grammar based on the grammar's filetype", -> - atom.activatePackage('git.tmbundle', sync: true) + atom.activatePackage('git-tmbundle', sync: true) expect(syntax.selectGrammar("file.js").name).toBe "JavaScript" # based on extension (.js) expect(syntax.selectGrammar("/tmp/.git/config").name).toBe "Git Config" # based on end of the path (.git/config) @@ -31,7 +31,7 @@ describe "the `syntax` global", -> expect(syntax.selectGrammar(filePath).name).toBe "Ruby" it "uses the number of newlines in the first line regex to determine the number of lines to test against", -> - atom.activatePackage('property-list.tmbundle', sync: true) + atom.activatePackage('property-list-tmbundle', sync: true) fileContent = "first-line\n" expect(syntax.selectGrammar("dummy.coffee", fileContent).name).toBe "CoffeeScript" diff --git a/spec/app/text-mate-grammar-spec.coffee b/spec/app/text-mate-grammar-spec.coffee index 382d549e4..b9985012a 100644 --- a/spec/app/text-mate-grammar-spec.coffee +++ b/spec/app/text-mate-grammar-spec.coffee @@ -8,17 +8,17 @@ describe "TextMateGrammar", -> grammar = null beforeEach -> - atom.activatePackage('text.tmbundle', sync: true) - atom.activatePackage('javascript.tmbundle', sync: true) + atom.activatePackage('text-tmbundle', sync: true) + atom.activatePackage('javascript-tmbundle', sync: true) atom.activatePackage('coffee-script-tmbundle', sync: true) - atom.activatePackage('ruby.tmbundle', sync: true) - atom.activatePackage('html.tmbundle', sync: true) - atom.activatePackage('php.tmbundle', sync: true) + atom.activatePackage('ruby-tmbundle', sync: true) + atom.activatePackage('html-tmbundle', sync: true) + atom.activatePackage('php-tmbundle', sync: true) grammar = syntax.selectGrammar("hello.coffee") describe "@loadSync(path)", -> - it "loads grammars from plists", -> - grammar = TextMateGrammar.loadSync(fsUtils.resolveOnLoadPath('packages/text.tmbundle/Syntaxes/Plain text.plist')) + it "loads grammars from plists", -> + grammar = TextMateGrammar.loadSync(fsUtils.resolveOnLoadPath('fixtures/sample.plist')) expect(grammar.scopeName).toBe "text.plain" {tokens} = grammar.tokenizeLine("this text is so plain. i love it.") expect(tokens[0]).toEqual value: "this text is so plain. i love it.", scopes: ["text.plain", "meta.paragraph.text"] @@ -212,7 +212,7 @@ describe "TextMateGrammar", -> describe "when the pattern includes rules from another grammar", -> describe "when a grammar matching the desired scope is available", -> it "parses tokens inside the begin/end patterns based on the included grammar's rules", -> - atom.activatePackage('html.tmbundle', sync: true) + atom.activatePackage('html-tmbundle', sync: true) atom.activatePackage('ruby-on-rails-tmbundle', sync: true) grammar = syntax.selectGrammar('foo.html.erb') @@ -243,7 +243,7 @@ describe "TextMateGrammar", -> expect(tokens[22]).toEqual value: '>', scopes: ["text.html.ruby","meta.tag.block.any.html","punctuation.definition.tag.end.html"] it "updates the grammar if the included grammar is updated later", -> - atom.activatePackage('html.tmbundle', sync: true) + atom.activatePackage('html-tmbundle', sync: true) atom.activatePackage('ruby-on-rails-tmbundle', sync: true) grammar = syntax.selectGrammar('foo.html.erb') @@ -253,7 +253,7 @@ describe "TextMateGrammar", -> {tokens} = grammar.tokenizeLine("
<% <<-SQL select * from users;") expect(tokens[12].value).toBe " select * from users;" - atom.activatePackage('sql.tmbundle', sync: true) + atom.activatePackage('sql-tmbundle', sync: true) expect(grammarUpdatedHandler).toHaveBeenCalled() {tokens} = grammar.tokenizeLine("
<% <<-SQL select * from users;") expect(tokens[12].value).toBe " " @@ -261,7 +261,7 @@ describe "TextMateGrammar", -> describe "when a grammar matching the desired scope is unavailable", -> it "updates the grammar if a matching grammar is added later", -> - atom.deactivatePackage('html.tmbundle') + atom.deactivatePackage('html-tmbundle') atom.activatePackage('ruby-on-rails-tmbundle', sync: true) grammar = syntax.selectGrammar('foo.html.erb') @@ -271,7 +271,7 @@ describe "TextMateGrammar", -> expect(tokens[2]).toEqual value: ' ', scopes: ["text.html.ruby","source.ruby.rails.embedded.html"] expect(tokens[3]).toEqual value: 'User', scopes: ["text.html.ruby","source.ruby.rails.embedded.html","support.class.ruby"] - atom.activatePackage('html.tmbundle', sync: true) + atom.activatePackage('html-tmbundle', sync: true) {tokens} = grammar.tokenizeLine("
<%= User.find(2).full_name %>
") expect(tokens[0]).toEqual value: '<', scopes: ["text.html.ruby","meta.tag.block.any.html","punctuation.definition.tag.begin.html"] expect(tokens[1]).toEqual value: 'div', scopes: ["text.html.ruby","meta.tag.block.any.html","entity.name.tag.block.any.html"] @@ -315,7 +315,7 @@ describe "TextMateGrammar", -> describe "when inside a C block", -> beforeEach -> - atom.activatePackage('c.tmbundle', sync: true) + atom.activatePackage('c-tmbundle', sync: true) it "correctly parses a method. (regression)", -> grammar = syntax.selectGrammar("hello.c") @@ -340,7 +340,7 @@ describe "TextMateGrammar", -> describe "when a grammar has a pattern that has back references in the match value", -> it "does not special handle the back references and instead allows oniguruma to resolve them", -> - atom.activatePackage('sass.tmbundle', sync: true) + atom.activatePackage('sass-tmbundle', sync: true) grammar = syntax.selectGrammar("style.scss") {tokens} = grammar.tokenizeLine("@mixin x() { -moz-selector: whatever; }") expect(tokens[9]).toEqual value: "-moz-selector", scopes: ["source.css.scss", "meta.property-list.scss", "meta.property-name.scss"] @@ -429,14 +429,14 @@ describe "TextMateGrammar", -> describe "when the grammar's pattern name has a group number in it", -> it "replaces the group number with the matched captured text", -> - atom.activatePackage('hyperlink-helper.tmbundle', sync: true) + atom.activatePackage('hyperlink-helper-tmbundle', sync: true) grammar = syntax.grammarForScopeName("text.hyperlink") {tokens} = grammar.tokenizeLine("https://github.com") expect(tokens[0].scopes).toEqual ["text.hyperlink", "markup.underline.link.https.hyperlink"] describe "when the grammar has an injection selector", -> it "includes the grammar's patterns when the selector matches the current scope in other grammars", -> - atom.activatePackage('hyperlink-helper.tmbundle', sync: true) + atom.activatePackage('hyperlink-helper-tmbundle', sync: true) grammar = syntax.selectGrammar("text.js") {tokens} = grammar.tokenizeLine("var i; // http://github.com") @@ -455,7 +455,7 @@ describe "TextMateGrammar", -> expect(tokens[1].value).toBe " http://github.com" expect(tokens[1].scopes).toEqual ["source.js", "comment.line.double-slash.js"] - atom.activatePackage('hyperlink-helper.tmbundle', sync: true) + atom.activatePackage('hyperlink-helper-tmbundle', sync: true) {tokens} = editSession.lineForScreenRow(0) expect(tokens[2].value).toBe "http://github.com" @@ -482,7 +482,7 @@ describe "TextMateGrammar", -> expect(tokens[1].value).toBe " SELECT * FROM OCTOCATS" expect(tokens[1].scopes).toEqual ["source.js", "comment.line.double-slash.js"] - atom.activatePackage('sql.tmbundle', sync: true) + atom.activatePackage('sql-tmbundle', sync: true) {tokens} = editSession.lineForScreenRow(0) expect(tokens[2].value).toBe "SELECT" @@ -516,7 +516,7 @@ describe "TextMateGrammar", -> describe "Git commit messages", -> beforeEach -> - atom.activatePackage('git.tmbundle', sync: true) + atom.activatePackage('git-tmbundle', sync: true) grammar = syntax.selectGrammar('COMMIT_EDITMSG') lines = grammar.tokenizeLines """ longggggggggggggggggggggggggggggggggggggggggggggggg @@ -535,7 +535,7 @@ describe "TextMateGrammar", -> describe "C++", -> beforeEach -> - atom.activatePackage('c.tmbundle', sync: true) + atom.activatePackage('c-tmbundle', sync: true) grammar = syntax.selectGrammar('includes.cc') lines = grammar.tokenizeLines """ #include "a.h" @@ -573,8 +573,8 @@ describe "TextMateGrammar", -> describe "Objective-C", -> beforeEach -> - atom.activatePackage('c.tmbundle', sync: true) - atom.activatePackage('objective-c.tmbundle', sync: true) + atom.activatePackage('c-tmbundle', sync: true) + atom.activatePackage('objective-c-tmbundle', sync: true) grammar = syntax.selectGrammar('function.mm') lines = grammar.tokenizeLines """ void test() { diff --git a/spec/app/tokenized-buffer-spec.coffee b/spec/app/tokenized-buffer-spec.coffee index 1d691eb64..7c35de244 100644 --- a/spec/app/tokenized-buffer-spec.coffee +++ b/spec/app/tokenized-buffer-spec.coffee @@ -7,7 +7,7 @@ describe "TokenizedBuffer", -> [tokenizedBuffer, buffer, changeHandler] = [] beforeEach -> - atom.activatePackage('javascript.tmbundle', sync: true) + atom.activatePackage('javascript-tmbundle', sync: true) # enable async tokenization TokenizedBuffer.prototype.chunkSize = 5 jasmine.unspy(TokenizedBuffer.prototype, 'tokenizeInBackground') @@ -327,7 +327,7 @@ describe "TokenizedBuffer", -> describe "when the grammar is updated because a grammar it includes is activated", -> it "retokenizes the buffer", -> - atom.activatePackage('ruby.tmbundle', sync: true) + atom.activatePackage('ruby-tmbundle', sync: true) atom.activatePackage('ruby-on-rails-tmbundle', sync: true) buffer = project.bufferForPath(null, "
<%= User.find(2).full_name %>
") @@ -339,7 +339,7 @@ describe "TokenizedBuffer", -> {tokens} = tokenizedBuffer.lineForScreenRow(0) expect(tokens[0]).toEqual value: "
", scopes: ["text.html.ruby"] - atom.activatePackage('html.tmbundle', sync: true) + atom.activatePackage('html-tmbundle', sync: true) fullyTokenize(tokenizedBuffer) {tokens} = tokenizedBuffer.lineForScreenRow(0) expect(tokens[0]).toEqual value: '<', scopes: ["text.html.ruby","meta.tag.block.any.html","punctuation.definition.tag.begin.html"] diff --git a/spec/fixtures/sample.plist b/spec/fixtures/sample.plist new file mode 100644 index 000000000..e5556c132 --- /dev/null +++ b/spec/fixtures/sample.plist @@ -0,0 +1,71 @@ + + + + + fileTypes + + txt + + keyEquivalent + ^~P + name + Plain Text + patterns + + + captures + + 1 + + name + punctuation.definition.item.text + + + match + ^\s*(•).*$\n? + name + meta.bullet-point.strong.text + + + captures + + 1 + + name + punctuation.definition.item.text + + + match + ^\s*(·).*$\n? + name + meta.bullet-point.light.text + + + captures + + 1 + + name + punctuation.definition.item.text + + + match + ^\s*(\*).*$\n? + name + meta.bullet-point.star.text + + + begin + ^([ \t]*)(?=\S) + contentName + meta.paragraph.text + end + ^(?!\1(?=\S)) + + + scopeName + text.plain + uuid + 3130E4FA-B10E-11D9-9F75-000D93589AF6 + + diff --git a/src/packages/grammar-selector/spec/grammar-selector-spec.coffee b/src/packages/grammar-selector/spec/grammar-selector-spec.coffee index 42466a300..86b6e1acd 100644 --- a/src/packages/grammar-selector/spec/grammar-selector-spec.coffee +++ b/src/packages/grammar-selector/spec/grammar-selector-spec.coffee @@ -9,8 +9,8 @@ describe "GrammarSelector", -> beforeEach -> window.rootView = new RootView atom.activatePackage('grammar-selector') - atom.activatePackage('text.tmbundle', sync: true) - atom.activatePackage('javascript.tmbundle', sync: true) + atom.activatePackage('text-tmbundle', sync: true) + atom.activatePackage('javascript-tmbundle', sync: true) rootView.open('sample.js') editor = rootView.getActiveView() textGrammar = _.find syntax.grammars, (grammar) -> grammar.name is 'Plain Text' diff --git a/src/packages/link/spec/link-spec.coffee b/src/packages/link/spec/link-spec.coffee index 26b0a4cb6..1a74dac33 100644 --- a/src/packages/link/spec/link-spec.coffee +++ b/src/packages/link/spec/link-spec.coffee @@ -6,8 +6,8 @@ describe "link package", -> [editor] = [] beforeEach -> - atom.activatePackage('javascript.tmbundle', sync: true) - atom.activatePackage('hyperlink-helper.tmbundle', sync: true) + atom.activatePackage('javascript-tmbundle', sync: true) + atom.activatePackage('hyperlink-helper-tmbundle', sync: true) window.rootView = new RootView rootView.open('sample.js') atom.activatePackage('link') diff --git a/src/packages/markdown-preview/spec/markdown-preview-view-spec.coffee b/src/packages/markdown-preview/spec/markdown-preview-view-spec.coffee index b3ae8b63c..1927df6a8 100644 --- a/src/packages/markdown-preview/spec/markdown-preview-view-spec.coffee +++ b/src/packages/markdown-preview/spec/markdown-preview-view-spec.coffee @@ -8,7 +8,7 @@ describe "MarkdownPreviewView", -> beforeEach -> project.setPath(project.resolve('markdown')) buffer = project.bufferForPath('file.markdown') - atom.activatePackage('ruby.tmbundle', sync: true) + atom.activatePackage('ruby-tmbundle', sync: true) preview = new MarkdownPreviewView(buffer) afterEach -> diff --git a/src/packages/snippets/spec/snippets-spec.coffee b/src/packages/snippets/spec/snippets-spec.coffee index de27a456a..c1f48178d 100644 --- a/src/packages/snippets/spec/snippets-spec.coffee +++ b/src/packages/snippets/spec/snippets-spec.coffee @@ -8,7 +8,7 @@ Package = require 'package' describe "Snippets extension", -> [buffer, editor, editSession] = [] beforeEach -> - atom.activatePackage('javascript.tmbundle', sync: true) + atom.activatePackage('javascript-tmbundle', sync: true) window.rootView = new RootView rootView.open('sample.js') @@ -235,7 +235,7 @@ describe "Snippets extension", -> describe "snippet loading", -> beforeEach -> - atom.loadPackage('package-with-broken-snippets.tmbundle', sync: true) + atom.loadPackage('package-with-broken-snippets-tmbundle', sync: true) atom.loadPackage('package-with-snippets') jasmine.unspy(window, "setTimeout") diff --git a/src/packages/spell-check/spec/spell-check-spec.coffee b/src/packages/spell-check/spec/spell-check-spec.coffee index 2838909d8..d12e9ab7a 100644 --- a/src/packages/spell-check/spec/spell-check-spec.coffee +++ b/src/packages/spell-check/spec/spell-check-spec.coffee @@ -4,8 +4,8 @@ describe "Spell check", -> [editor] = [] beforeEach -> - atom.activatePackage('text.tmbundle', sync: true) - atom.activatePackage('javascript.tmbundle', sync: true) + atom.activatePackage('text-tmbundle', sync: true) + atom.activatePackage('javascript-tmbundle', sync: true) window.rootView = new RootView rootView.open('sample.js') config.set('spell-check.grammars', []) diff --git a/src/packages/status-bar/spec/status-bar-spec.coffee b/src/packages/status-bar/spec/status-bar-spec.coffee index 987aa3bd7..47239ee64 100644 --- a/src/packages/status-bar/spec/status-bar-spec.coffee +++ b/src/packages/status-bar/spec/status-bar-spec.coffee @@ -184,8 +184,8 @@ describe "StatusBar", -> describe "grammar label", -> beforeEach -> - atom.activatePackage('text.tmbundle', sync: true) - atom.activatePackage('javascript.tmbundle', sync: true) + atom.activatePackage('text-tmbundle', sync: true) + atom.activatePackage('javascript-tmbundle', sync: true) it "displays the name of the current grammar", -> expect(statusBar.find('.grammar-name').text()).toBe 'JavaScript'