Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions embedding/embedding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,7 @@ var _ = Describe("Embedding", func() {
Expect(processor.IsUpToDate()).Should(BeTrue())
})

// TODO:olena-zmiiova:https://github.com/SpineEventEngine/embed-code/issues/59
It("should have error as it has invalid transition map", func() {
Skip(
"Temporarily disabled, see " +
"[issue #59](https://github.com/SpineEventEngine/embed-code/issues/59).",
)
docPath := fmt.Sprintf("%s/split-lines.md", config.DocumentationRoot)

falseTransitions := parsing.TransitionMap{
Expand Down Expand Up @@ -256,12 +251,9 @@ var _ = Describe("Embedding", func() {
))
})

// TODO:olena-zmiiova:https://github.com/SpineEventEngine/embed-code/issues/65
It("should successfully embed to a file in a nested dir", func() {
Skip(
"Temporarily disabled, see " +
"[issue #65](https://github.com/SpineEventEngine/embed-code/issues/65).",
)
config.CodeRoots = _type.NamedPathList{_type.NamedPath{Path: "../test/resources/code/kotlin"}}
config.DocIncludes = []string{"nested-dir-1/nested-dir-2/nested-dir-doc.md"}
docPath := fmt.Sprintf("%s/nested-dir-1/nested-dir-2/nested-dir-doc.md",
config.DocumentationRoot)
processor := embedding.NewProcessor(docPath, config)
Expand Down
14 changes: 14 additions & 0 deletions embedding/parsing/instruction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,20 @@ var _ = Describe("Instruction", func() {
Expect(actualLines[1]).Should(MatchRegexp(expectedLastLinePattern))
})

It("should embed one line when start and end globs match the same line", func() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add .. the start this makes this more readable since it's clear that start is a noun.

instructionParams := TestInstructionParams{
startGlob: "*spine.enableJava()*",
endGlob: "*.server()",
}

actualLines := getXMLExtractionContent(
"examples/hello/build.gradle", instructionParams, config)

Expect(actualLines).Should(Equal([]string{
"spine.enableJava().server()",
}))
})

It("should successfully parse XML by globs with line starts", func() {
instructionParams := TestInstructionParams{
startGlob: "^foo",
Expand Down
2 changes: 1 addition & 1 deletion embedding/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func unacceptedTransitionError(context parsing.Context) error {
// it successfully moved to the next state and returns the new state.
func (p Processor) moveToNextState(state *parsing.State, context *parsing.Context) (
bool, *parsing.State, error) {
for _, nextState := range parsing.Transitions[*state] {
for _, nextState := range p.TransitionsMap[*state] {
if nextState.Recognize(*context) {
err := nextState.Accept(context, p.Config)
if err != nil {
Expand Down
11 changes: 11 additions & 0 deletions test/resources/code/java/examples/hello/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
id 'java'
}

spine.enableJava().server()

tasks.register('hello') {
doLast {
println 'Hello'
}
}
Loading