Skip to content
This repository has been archived by the owner on Mar 19, 2019. It is now read-only.

Commit

Permalink
This adds a test. It adds only a test. (#614)
Browse files Browse the repository at this point in the history
* upgrade editor to a recent Rug version

and some formatting

* a test for a language extension

I'm attempting to make this simple
but it is not. I can work from here on making it
a little simpler.
  • Loading branch information
jessitron authored and kipz committed May 24, 2017
1 parent 544f014 commit 63dc3c8
Show file tree
Hide file tree
Showing 9 changed files with 236 additions and 145 deletions.
15 changes: 15 additions & 0 deletions .atomist.yml
Expand Up @@ -256,3 +256,18 @@ editor:
parameters:
- "class_under_test": "com.atomist.tree.content.text.microgrammar.MultipleUseOfSubmatcher"

---
kind: "operation"
client: "rug-cli 1.0.0-m.2"
editor:
name: "AddTypeScriptTest"
group: "atomist"
artifact: "rug"
version: "0.3.0"
origin:
repo: "git@github.com:atomist/rug"
branch: "master"
sha: "fa808f2*"
parameters:
- "class_under_test": "com.atomist.rug.kind.PandaParsing"

4 changes: 2 additions & 2 deletions .atomist/editors/AddTypeScriptTest.ts
Expand Up @@ -29,8 +29,8 @@ class AddTypeScriptTest {
let ts_file_path = "src/test/resources/" + ts_under_resources
let scala_file_path = "src/test/scala/" + this.class_under_test.replace(/\./g, '/') + "TypeScriptTest.scala"

project.copyEditorBackingFileOrFail(sample_ts_file_path, ts_file_path)
project.copyEditorBackingFileOrFail("src/test/scala/com/atomist/rug/ts/SampleTypeScriptTest.scala", scala_file_path)
project.copyEditorBackingFileOrFailToDestination(sample_ts_file_path, ts_file_path)
project.copyEditorBackingFileOrFailToDestination("src/test/scala/com/atomist/rug/ts/SampleTypeScriptTest.scala", scala_file_path)

let tsFile = project.findFile(ts_file_path)
tsFile.replace("Sample", class_name)
Expand Down
4 changes: 2 additions & 2 deletions .atomist/manifest.yml
@@ -1,6 +1,6 @@
group: atomist
artifact: rug
version: "0.2.0"
requires: "[0.13.0,1.0.0)"
version: "0.3.0"
requires: "[1.0.0-m.3,2.0.0)"
dependencies:
extensions:
@@ -1,4 +1,6 @@

com.atomist.rug.kind.test.ReplacerType

com.atomist.rug.kind.test.ReplacerCljType
com.atomist.rug.kind.test.ReplacerCljType

com.atomist.rug.kind.PandaRugLanguageExtension
@@ -0,0 +1,26 @@
import { Project, File } from '@atomist/rug/model/Core'
import { Editor } from '@atomist/rug/operations/Decorators'
import { PathExpressionEngine, TextTreeNode } from '@atomist/rug/tree/PathExpression'
import { Parameter } from "@atomist/rug/operations/Decorators";
import { Pattern } from "@atomist/rug/operations/RugOperation";

@Editor("PandaParsingTypeScriptTest", "Uses PandaParsing from TypeScript")
class PandaParsingTypeScriptTest {

@Parameter({ pattern: Pattern.any })
changePandasInCurliesTo: string;

edit(project: Project) {

let eng : PathExpressionEngine = project.context.pathExpressionEngine;

let pandafile = eng.scalar<Project, File>(project, `/my.panda`);
let parsedPanda = eng.scalar<File, TextTreeNode>(pandafile, "/Panda()");

eng.with<TextTreeNode>(parsedPanda, `/curly/word`, pandaWord => {
pandaWord.update(this.changePandasInCurliesTo);
})

}
}
export let editor = new PandaParsingTypeScriptTest();

This file was deleted.

This file was deleted.

6 changes: 3 additions & 3 deletions src/test/resources/com/atomist/rug/ts/SampleTypeScriptTest.ts
@@ -1,6 +1,6 @@
import { Project, File } from '@atomist/rug/model/Core'
import { Editor } from '@atomist/rug/operations/Decorators'
import { PathExpressionEngine } from '@atomist/rug/tree/PathExpression'
import { Project, File } from "@atomist/rug/model/Core"
import { Editor } from "@atomist/rug/operations/Decorators"
import { PathExpressionEngine } from "@atomist/rug/tree/PathExpression"

@Editor("SampleTypeScriptTest", "Uses Sample from TypeScript")
class SampleTypeScriptTest {
Expand Down

0 comments on commit 63dc3c8

Please sign in to comment.