diff --git a/embedding/embedding_test.go b/embedding/embedding_test.go index d30a421..f2857c3 100644 --- a/embedding/embedding_test.go +++ b/embedding/embedding_test.go @@ -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{ @@ -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) diff --git a/embedding/parsing/instruction_test.go b/embedding/parsing/instruction_test.go index 8361dd0..139dc82 100644 --- a/embedding/parsing/instruction_test.go +++ b/embedding/parsing/instruction_test.go @@ -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() { + 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", diff --git a/embedding/processor.go b/embedding/processor.go index df99270..764a57a 100644 --- a/embedding/processor.go +++ b/embedding/processor.go @@ -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 { diff --git a/test/resources/code/java/examples/hello/build.gradle b/test/resources/code/java/examples/hello/build.gradle new file mode 100644 index 0000000..fd31569 --- /dev/null +++ b/test/resources/code/java/examples/hello/build.gradle @@ -0,0 +1,11 @@ +plugins { + id 'java' +} + +spine.enableJava().server() + +tasks.register('hello') { + doLast { + println 'Hello' + } +}