diff options
author | João Baptista <15786310+M4RC3L05@users.noreply.github.com> | 2024-11-19 21:01:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-19 21:01:16 +0000 |
commit | c55e936be03a3a023330789f903e2fbd12f4a308 (patch) | |
tree | 0dc406b0cfb82a6c0683edb9152c6450aa3abf52 /tests/testdata | |
parent | 628816448ea45807762fd8eb0c59302c9f2aac9a (diff) |
feat(fmt): support SQL (#26750)
This commit adds support for .sql files in "deno fmt" subcommand.
Closes: https://github.com/denoland/deno/issues/25024
---------
Signed-off-by: m4rc3l05 <15786310+M4RC3L05@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Diffstat (limited to 'tests/testdata')
-rw-r--r-- | tests/testdata/fmt/badly_formatted.md | 12 | ||||
-rw-r--r-- | tests/testdata/fmt/badly_formatted.sql | 21 | ||||
-rw-r--r-- | tests/testdata/fmt/badly_formatted_fixed.md | 15 | ||||
-rw-r--r-- | tests/testdata/fmt/badly_formatted_fixed.sql | 22 |
4 files changed, 70 insertions, 0 deletions
diff --git a/tests/testdata/fmt/badly_formatted.md b/tests/testdata/fmt/badly_formatted.md index 642918cea..be90ff845 100644 --- a/tests/testdata/fmt/badly_formatted.md +++ b/tests/testdata/fmt/badly_formatted.md @@ -63,3 +63,15 @@ function foo(): number { let a:number </script> ``` + + +```sql + seLect * , biz, buz +from baz; +``` + +```sql +-- deno-fmt-ignore-file + seLect * , biz, buz +from baz; +``` diff --git a/tests/testdata/fmt/badly_formatted.sql b/tests/testdata/fmt/badly_formatted.sql new file mode 100644 index 000000000..8b4cb978f --- /dev/null +++ b/tests/testdata/fmt/badly_formatted.sql @@ -0,0 +1,21 @@ +select * from foo; +update foo set a = 'b'Where id = 'biz'; + + + create table foo(id text not null +bar text, + biz int, + buz number NOT NULL +); + +INSERT + into + user_data + (first_name, +last_name, address, phone, email) +VALUES + ('foo', 'bar', + 'biz', 1, 'bix'); + + + diff --git a/tests/testdata/fmt/badly_formatted_fixed.md b/tests/testdata/fmt/badly_formatted_fixed.md index 21176742b..7a482e058 100644 --- a/tests/testdata/fmt/badly_formatted_fixed.md +++ b/tests/testdata/fmt/badly_formatted_fixed.md @@ -56,3 +56,18 @@ function foo(): number { let a: number; </script> ``` + +```sql +SELECT + *, + biz, + buz +FROM + baz; +``` + +```sql +-- deno-fmt-ignore-file + seLect * , biz, buz +from baz; +``` diff --git a/tests/testdata/fmt/badly_formatted_fixed.sql b/tests/testdata/fmt/badly_formatted_fixed.sql new file mode 100644 index 000000000..d50c61921 --- /dev/null +++ b/tests/testdata/fmt/badly_formatted_fixed.sql @@ -0,0 +1,22 @@ +SELECT + * +FROM + foo; + +UPDATE + foo +SET + a = 'b' +WHERE + id = 'biz'; + +CREATE TABLE foo( + id text NOT NULL bar text, + biz int, + buz number NOT NULL +); + +INSERT INTO + user_data (first_name, last_name, address, phone, email) +VALUES + ('foo', 'bar', 'biz', 1, 'bix'); |