Skip to content

Commit

Permalink
Consistent formatting of multiline strings
Browse files Browse the repository at this point in the history
Plus some other formatting improvements
  • Loading branch information
losipiuk committed Oct 31, 2024
1 parent 4475590 commit 16b41f6
Show file tree
Hide file tree
Showing 140 changed files with 4,545 additions and 3,201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ public void testNulls()
@Test
public void testTwoValueState()
{
assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
reduce(
a,
CAST(ROW(0, 0) AS ROW(sum BIGINT, count INTEGER)),
Expand All @@ -117,7 +118,8 @@ public void testTwoValueState()
""")
.binding("a", "ARRAY [5, 20, 50]"))
.isEqualTo(25L);
assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
reduce(
a,
CAST(ROW(0.0E0, 0) AS ROW(sum DOUBLE, count INTEGER)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,23 +539,26 @@ public void testIn()
@Test
public void testSearchCase()
{
assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when value then 33
end
""")
.binding("value", "true"))
.matches("33");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when value then BIGINT '33'
end
""")
.binding("value", "true"))
.matches("BIGINT '33'");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when value then 1
else 33
Expand All @@ -564,7 +567,8 @@ public void testSearchCase()
.binding("value", "false"))
.matches("33");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when value then 10000000000
else 33
Expand All @@ -573,7 +577,8 @@ public void testSearchCase()
.binding("value", "false"))
.matches("BIGINT '33'");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when condition1 then 1
when condition2 then 1
Expand All @@ -586,7 +591,8 @@ public void testSearchCase()
.binding("condition3", "true"))
.matches("33");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when condition1 then BIGINT '1'
when condition2 then 1
Expand All @@ -599,7 +605,8 @@ public void testSearchCase()
.binding("condition3", "true"))
.matches("BIGINT '33'");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when condition1 then 10000000000
when condition2 then 1
Expand All @@ -612,15 +619,17 @@ public void testSearchCase()
.binding("condition3", "true"))
.matches("BIGINT '33'");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when value then 1
end
""")
.binding("value", "false"))
.matches("CAST(null AS integer)");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when value then null
else 'foo'
Expand All @@ -629,7 +638,8 @@ public void testSearchCase()
.binding("value", "true"))
.isNull(createVarcharType(3));

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when condition1 then 1
when condition2 then 33
Expand All @@ -639,7 +649,8 @@ public void testSearchCase()
.binding("condition2", "true"))
.matches("33");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when condition1 then 10000000000
when condition2 then 33
Expand All @@ -649,7 +660,8 @@ public void testSearchCase()
.binding("condition2", "true"))
.matches("BIGINT '33'");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when condition1 then 1.0E0
when condition2 then 33
Expand All @@ -659,7 +671,8 @@ public void testSearchCase()
.binding("condition2", "true"))
.matches("33E0");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when condition1 then 2.2
when condition2 then 2.2
Expand All @@ -670,7 +683,8 @@ public void testSearchCase()
.hasType(createDecimalType(2, 1))
.matches("2.2");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when condition1 then 1234567890.0987654321
when condition2 then 3.3
Expand All @@ -680,7 +694,8 @@ public void testSearchCase()
.binding("condition2", "true"))
.matches("CAST(3.3 AS decimal(20, 10))");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when condition1 then 1
when condition2 then 2.2
Expand All @@ -690,7 +705,8 @@ public void testSearchCase()
.binding("condition2", "true"))
.matches("CAST(2.2 AS decimal(11, 1))");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case
when condition1 then 1.1
when condition2 then 33E0
Expand All @@ -704,7 +720,8 @@ public void testSearchCase()
@Test
public void testSimpleCase()
{
assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition then CAST(null AS varchar)
else 'foo'
Expand All @@ -714,7 +731,8 @@ when condition then CAST(null AS varchar)
.binding("condition", "true"))
.matches("CAST(null AS varchar)");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition then 33
end
Expand All @@ -723,7 +741,8 @@ when condition then CAST(null AS varchar)
.binding("condition", "true"))
.matches("33");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition then BIGINT '33'
end
Expand All @@ -732,7 +751,8 @@ when condition then CAST(null AS varchar)
.binding("condition", "true"))
.matches("BIGINT '33'");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition then 1
else 33
Expand All @@ -742,7 +762,8 @@ when condition then CAST(null AS varchar)
.binding("condition", "false"))
.matches("33");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition then 10000000000
else 33
Expand All @@ -752,7 +773,8 @@ when condition then CAST(null AS varchar)
.binding("condition", "false"))
.matches("BIGINT '33'");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition1 then 1
when condition2 then 1
Expand All @@ -766,7 +788,8 @@ when condition then CAST(null AS varchar)
.binding("condition3", "true"))
.matches("33");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition then 1
end
Expand All @@ -775,7 +798,8 @@ when condition then CAST(null AS varchar)
.binding("condition", "false"))
.isNull(INTEGER);

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition then null
else 'foo'
Expand All @@ -785,7 +809,8 @@ when condition then CAST(null AS varchar)
.binding("condition", "true"))
.isNull(createVarcharType(3));

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition1 then 10000000000
when condition2 then 33
Expand All @@ -796,7 +821,8 @@ when condition then CAST(null AS varchar)
.binding("condition2", "true"))
.matches("BIGINT '33'");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition1 then 1
when condition2 then 33
Expand All @@ -807,7 +833,8 @@ when condition then CAST(null AS varchar)
.binding("condition2", "true"))
.matches("33");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition then 1
else 33
Expand All @@ -817,7 +844,8 @@ when condition then CAST(null AS varchar)
.binding("condition", "true"))
.matches("33");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition1 then 1E0
when condition2 then 33
Expand All @@ -828,7 +856,8 @@ when condition then CAST(null AS varchar)
.binding("condition2", "true"))
.matches("33E0");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition1 then 2.2
when condition2 then 2.2
Expand All @@ -839,7 +868,8 @@ when condition then CAST(null AS varchar)
.binding("condition2", "true"))
.matches("2.2");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition1 then 1234567890.0987654321
when condition2 then 3.3
Expand All @@ -850,7 +880,8 @@ when condition then CAST(null AS varchar)
.binding("condition2", "true"))
.matches("CAST(3.3 AS decimal(20, 10))");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition1 then 1
when condition2 then 2.2
Expand All @@ -861,7 +892,8 @@ when condition then CAST(null AS varchar)
.binding("condition2", "true"))
.matches("CAST(2.2 AS decimal(11, 1))");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition1 then 1.1
when condition2 then 33E0
Expand All @@ -872,7 +904,8 @@ when condition then CAST(null AS varchar)
.binding("condition2", "true"))
.matches("33E0");

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition1 then result1
when condition2 then result2
Expand All @@ -889,7 +922,8 @@ when condition then CAST(null AS varchar)
@Test
public void testSimpleCaseWithCoercions()
{
assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition1 then 1
when condition2 then 2
Expand All @@ -900,7 +934,8 @@ public void testSimpleCaseWithCoercions()
.binding("condition2", "real '8.1'"))
.isNull(INTEGER);

assertThat(assertions.expression("""
assertThat(assertions.expression(
"""
case value
when condition1 then 1
when condition2 then 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ public void testUnescapeValidLikePattern()
@Test
public void testLikeWithDynamicPattern()
{
assertThat(assertions.query("""
assertThat(assertions.query(
"""
SELECT value FROM (
VALUES
('a', 'a'),
Expand All @@ -343,7 +344,8 @@ SELECT value FROM (
"""))
.matches("VALUES 'a', 'c'");

assertThat(assertions.query("""
assertThat(assertions.query(
"""
SELECT value FROM (
VALUES
('a%b', 'aX%b', 'X'),
Expand Down
Loading

0 comments on commit 16b41f6

Please sign in to comment.