From 365aa30b7f7a271ab7e0259faf334a8e3e3dfb8e Mon Sep 17 00:00:00 2001 From: James Rodewig Date: Wed, 25 Sep 2019 12:35:48 -0400 Subject: [PATCH] [DOCS] Remove support for `// CONSOLE` magic comment (#46936) (#47110) #46180 added support for the `[source,console]` language for snippets which should be tested. This removes support for the `// CONSOLE` magic comment, which serve a similar purpose. Snippets that include the `// CONSOLE` magic comment will return an exception. --- .../gradle/doc/RestTestsFromSnippetsTask.groovy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy index 54db2cd7162..b42bc83b472 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy @@ -206,8 +206,11 @@ public class RestTestsFromSnippetsTask extends SnippetsTask { response(snippet) return } - if (snippet.test || snippet.console || - snippet.language == 'console') { + if ((snippet.language == 'js') && (snippet.console)) { + throw new InvalidUserDataException( + "$snippet: Use `[source,console]` instead of `// CONSOLE`.") + } + if (snippet.test || snippet.language == 'console') { test(snippet) previousTest = snippet return