Skip to content

Commit 38a783c

Browse files
committed
Generate Atom spec test files
1 parent 1381f14 commit 38a783c

File tree

6 files changed

+14726
-4
lines changed

6 files changed

+14726
-4
lines changed

Diff for: .travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ install:
77
- make
88

99
script:
10-
- make test
10+
- make ci-test
11+
- 'curl -s https://raw.githubusercontent.com/atom/ci/master/build-package.sh | sh'

Diff for: Makefile

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
.PHONY: all test release devenv publish
1+
.PHONY: all ci-test test release devenv publish
22

33
all: devenv release
44

5-
test: release
5+
ci-test: release
66
# Run tests
77
./node_modules/.bin/syntaxdev test --tests test/**/*.py --syntax grammars/src/MagicPython.syntax.yaml
88
./node_modules/.bin/syntaxdev test --tests test/**/*.re --syntax grammars/src/MagicRegExp.syntax.yaml
@@ -15,8 +15,11 @@ test: release
1515
] ; \
1616
then echo "Error: package.version != git.tag" && exit 1 ; fi
1717

18+
test: ci-test
19+
atom -t .
20+
1821
devenv:
19-
npm install [email protected].13
22+
npm install [email protected].15
2023

2124
release:
2225
./node_modules/.bin/syntaxdev build-plist --in grammars/src/MagicPython.syntax.yaml --out grammars/MagicPython.tmLanguage
@@ -27,6 +30,9 @@ release:
2730

2831
./node_modules/.bin/syntaxdev scopes --syntax grammars/src/MagicPython.syntax.yaml > misc/scopes
2932

33+
./node_modules/.bin/syntaxdev atom-spec --package-name MagicPython --tests test/**/*.py --syntax grammars/src/MagicPython.syntax.yaml --out test/atom-spec/python-spec.js
34+
./node_modules/.bin/syntaxdev atom-spec --package-name MagicPython --tests test/**/*.re --syntax grammars/src/MagicRegExp.syntax.yaml --out test/atom-spec/python-re-spec.js
35+
3036
publish: test
3137
apm publish patch
3238
rm -rf ./node_modules/syntaxdev

Diff for: test/atom-spec/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This directory contains tests for Atom editor. Spec files prefixed
2+
with `python-` are autogenerated by `make`.

Diff for: test/atom-spec/basics-spec.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
describe("MagicPython basic integration tests", function() {
2+
var grammar = null;
3+
4+
beforeEach(function() {
5+
waitsForPromise(function() {
6+
return atom.packages.activatePackage("MagicPython")
7+
});
8+
runs(function() {
9+
grammar = atom.grammars.grammarForScopeName("source.python")
10+
});
11+
});
12+
13+
it("recognises shebang on firstline", function() {
14+
expect(grammar.firstLineRegex.scanner.findNextMatchSync(
15+
"#!/usr/bin/env python")).not.toBeNull();
16+
17+
expect(grammar.firstLineRegex.scanner.findNextMatchSync(
18+
"#! /usr/bin/env python")).not.toBeNull();
19+
});
20+
21+
it("parses the grammar", function() {
22+
expect(grammar).toBeDefined();
23+
expect(grammar.scopeName).toBe("source.python");
24+
});
25+
});

0 commit comments

Comments
 (0)