aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel Perez Alvarez <danielpza@protonmail.com>2025-01-19 12:28:28 -0800
committerGitHub <noreply@github.com>2025-01-19 12:28:28 -0800
commit37f0a048bf91c7a145b33e98c984eb58132fb2f6 (patch)
tree487e711d7a33cf10256bea2ed932bfdd3818aa9b /test
parente3db0e795b7675062b9a65ed19077dfa6d913ea8 (diff)
feat: add gdformat formatter for godot/gdscript (#342)
Add [gdformat](https://github.com/Scony/godot-gdscript-toolkit?tab=readme-ov-file#formatting-with-gdformat-more) for godot gdscript files See - https://godotengine.org/ - https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html - https://github.com/Scony/godot-gdscript-toolkit --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
Diffstat (limited to 'test')
-rw-r--r--test/formatters/installers/gdformat.bash2
-rw-r--r--test/formatters/samplecode/gdformat/in.gd9
-rw-r--r--test/formatters/samplecode/gdformat/out.gd15
3 files changed, 26 insertions, 0 deletions
diff --git a/test/formatters/installers/gdformat.bash b/test/formatters/installers/gdformat.bash
new file mode 100644
index 0000000..4ecfae1
--- /dev/null
+++ b/test/formatters/installers/gdformat.bash
@@ -0,0 +1,2 @@
+apt-get install -y python3-pip
+pip3 install "gdtoolkit==4.*"
diff --git a/test/formatters/samplecode/gdformat/in.gd b/test/formatters/samplecode/gdformat/in.gd
new file mode 100644
index 0000000..9e30e3d
--- /dev/null
+++ b/test/formatters/samplecode/gdformat/in.gd
@@ -0,0 +1,9 @@
+class X:
+ var x=[1,2,{'a':1}]
+ var y=[1,2,3,] # trailing comma
+ func foo(a:int,b,c=[1,2,3]):
+ if a in c and \
+ b > 100:
+ print('foo')
+func bar():
+ print('bar')
diff --git a/test/formatters/samplecode/gdformat/out.gd b/test/formatters/samplecode/gdformat/out.gd
new file mode 100644
index 0000000..bede6f6
--- /dev/null
+++ b/test/formatters/samplecode/gdformat/out.gd
@@ -0,0 +1,15 @@
+class X:
+ var x = [1, 2, {"a": 1}]
+ var y = [
+ 1,
+ 2,
+ 3,
+ ] # trailing comma
+
+ func foo(a: int, b, c = [1, 2, 3]):
+ if a in c and b > 100:
+ print("foo")
+
+
+func bar():
+ print("bar")