summaryrefslogtreecommitdiff
path: root/tests/specs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/specs')
-rw-r--r--tests/specs/fmt/sql/__test__.jsonc25
-rw-r--r--tests/specs/fmt/sql/badly_formatted.sql1
-rw-r--r--tests/specs/fmt/sql/ignore_file.sql3
-rw-r--r--tests/specs/fmt/sql/ignore_file2.sql3
-rw-r--r--tests/specs/fmt/sql/ignore_file3.sql6
-rw-r--r--tests/specs/fmt/sql/ignore_file4.sql3
-rw-r--r--tests/specs/fmt/sql/well_formatted.sql4
-rw-r--r--tests/specs/fmt/sql/wrong_file_ignore.sql6
8 files changed, 51 insertions, 0 deletions
diff --git a/tests/specs/fmt/sql/__test__.jsonc b/tests/specs/fmt/sql/__test__.jsonc
new file mode 100644
index 000000000..a335e79c2
--- /dev/null
+++ b/tests/specs/fmt/sql/__test__.jsonc
@@ -0,0 +1,25 @@
+{
+ "tempDir": true,
+ "tests": {
+ "nothing": {
+ "args": "fmt",
+ "output": "Checked 7 files\n"
+ },
+ "flag": {
+ "args": "fmt --unstable-sql",
+ "output": "[UNORDERED_START]\n[WILDLINE]badly_formatted.sql\n[WILDLINE]well_formatted.sql\n[WILDLINE]wrong_file_ignore.sql\n[UNORDERED_END]\nChecked 7 files\n"
+ },
+ "config_file": {
+ "steps": [{
+ "args": [
+ "eval",
+ "Deno.writeTextFile('deno.json', '{\\n \"unstable\": [\"fmt-sql\"]\\n}\\n')"
+ ],
+ "output": "[WILDCARD]"
+ }, {
+ "args": "fmt",
+ "output": "[UNORDERED_START]\n[WILDLINE]badly_formatted.sql\n[WILDLINE]well_formatted.sql\n[WILDLINE]wrong_file_ignore.sql\n[UNORDERED_END]\nChecked 8 files\n"
+ }]
+ }
+ }
+}
diff --git a/tests/specs/fmt/sql/badly_formatted.sql b/tests/specs/fmt/sql/badly_formatted.sql
new file mode 100644
index 000000000..619fc7afd
--- /dev/null
+++ b/tests/specs/fmt/sql/badly_formatted.sql
@@ -0,0 +1 @@
+select *; \ No newline at end of file
diff --git a/tests/specs/fmt/sql/ignore_file.sql b/tests/specs/fmt/sql/ignore_file.sql
new file mode 100644
index 000000000..62418c611
--- /dev/null
+++ b/tests/specs/fmt/sql/ignore_file.sql
@@ -0,0 +1,3 @@
+-- deno-fmt-ignore-file
+
+foo%!
diff --git a/tests/specs/fmt/sql/ignore_file2.sql b/tests/specs/fmt/sql/ignore_file2.sql
new file mode 100644
index 000000000..fe9969f1d
--- /dev/null
+++ b/tests/specs/fmt/sql/ignore_file2.sql
@@ -0,0 +1,3 @@
+--deno-fmt-ignore-file
+
+foo%!
diff --git a/tests/specs/fmt/sql/ignore_file3.sql b/tests/specs/fmt/sql/ignore_file3.sql
new file mode 100644
index 000000000..c87da3e59
--- /dev/null
+++ b/tests/specs/fmt/sql/ignore_file3.sql
@@ -0,0 +1,6 @@
+-- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+-- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
+-- quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+-- deno-fmt-ignore-file
+
+ foo%!
diff --git a/tests/specs/fmt/sql/ignore_file4.sql b/tests/specs/fmt/sql/ignore_file4.sql
new file mode 100644
index 000000000..2de65712a
--- /dev/null
+++ b/tests/specs/fmt/sql/ignore_file4.sql
@@ -0,0 +1,3 @@
+-- deno-fmt-ignore-file Foo bar biz
+
+ foo%!
diff --git a/tests/specs/fmt/sql/well_formatted.sql b/tests/specs/fmt/sql/well_formatted.sql
new file mode 100644
index 000000000..92ce98018
--- /dev/null
+++ b/tests/specs/fmt/sql/well_formatted.sql
@@ -0,0 +1,4 @@
+SELECT
+ *
+FROM
+ foo;
diff --git a/tests/specs/fmt/sql/wrong_file_ignore.sql b/tests/specs/fmt/sql/wrong_file_ignore.sql
new file mode 100644
index 000000000..c124855dc
--- /dev/null
+++ b/tests/specs/fmt/sql/wrong_file_ignore.sql
@@ -0,0 +1,6 @@
+-- File ignore directive only works if it's in the first cluster
+-- of comment, ie. there are no empty lines after the first n-leading lines.
+
+-- deno-fmt-ignore-file
+
+ foo \ No newline at end of file