Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 41805fa

Browse files
Merge pull request #274 from Trivadis/bugfix/issue-267-spaces-in-grant
Bugfix/issue 267 spaces in grant
2 parents a21347a + d11dc0c commit 41805fa

3 files changed

Lines changed: 48 additions & 2 deletions

File tree

settings/sql_developer/trivadis_custom_format.arbori

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1851,7 +1851,7 @@ a8_one_space_after:
18511851
| a8_update
18521852
-> {
18531853
var node = tuple.get("node");
1854-
if (!hasCommentsBetweenPos(node.from, node.to)) {
1854+
if (overrideIndents(node.from) && !hasCommentsBetweenPos(node.from, node.to)) {
18551855
struct.putNewline(node.to, " ");
18561856
var content = target.src.get(node.from).content;
18571857
logger.fine(struct.getClass(), "a8_one_space_after: <" + content + "> at " + node.to + ".");

standalone/src/test/java/com/trivadis/plsql/formatter/settings/tests/grammar/plsql/Compile_clause.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public void alter_function() throws IOException {
2727
var actual = getFormatter().format(input);
2828
var expected = """
2929
alter
30-
function f
30+
function
31+
f
3132
compile
3233
reuse
3334
settings;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.trivadis.plsql.formatter.settings.tests.issues;
2+
3+
import com.trivadis.plsql.formatter.settings.ConfiguredTestFormatter;
4+
import org.junit.jupiter.api.Test;
5+
import org.junit.jupiter.api.TestInstance;
6+
7+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
8+
public class Issue_267_spaces_in_grant extends ConfiguredTestFormatter {
9+
@Test
10+
public void keep_spaces_in_grant_statements() {
11+
var input = """
12+
grant debug connect session to scott;
13+
grant debug any procedure to scott;
14+
grant execute on dbms_debug_jdwp to scott;
15+
""";
16+
formatAndAssert(input);
17+
}
18+
19+
@Test
20+
public void keep_spaces_in_grant_statements_one_token_per_line() {
21+
var input = """
22+
grant
23+
debug
24+
connect
25+
session
26+
to
27+
scott;
28+
29+
grant
30+
debug
31+
any
32+
procedure
33+
to
34+
scott;
35+
36+
grant
37+
execute
38+
on
39+
dbms_debug_jdwp
40+
to
41+
scott;
42+
""";
43+
formatAndAssert(input);
44+
}
45+
}

0 commit comments

Comments
 (0)