Skip to content

Commit ca2bb38

Browse files
Fix LEAST header formatting and add test coverage for documentation queries
1 parent 1833203 commit ca2bb38

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

docs/sphinx/source/reference/Functions/scalar_functions/least.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
====
1+
=====
22
LEAST
33
=====
44

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* DocumentationQueriesTests.java
3+
*
4+
* This source file is part of the FoundationDB open source project
5+
*
6+
* Copyright 2015-2025 Apple Inc. and the FoundationDB project authors
7+
*
8+
* Licensed under the Apache License, Version 2.0 (the "License");
9+
* you may not use this file except in compliance with the License.
10+
* You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing, software
15+
* distributed under the License is distributed on an "AS IS" BASIS,
16+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
* See the License for the specific language governing permissions and
18+
* limitations under the License.
19+
*/
20+
21+
import com.apple.foundationdb.relational.yamltests.YamlTest;
22+
import org.junit.jupiter.api.TestTemplate;
23+
24+
/**
25+
* Test suite that aims to run all sample SQL queries defined in the documentation. This ensures
26+
* that as SQL syntax and capabilities evolve, the documentation remains consistent and up to date.
27+
*/
28+
@YamlTest
29+
class DocumentationQueriesTests {
30+
private static final String PREFIX = "documentation-queries";
31+
32+
@TestTemplate
33+
void withDocumentationQueriesTests(YamlTest.Runner runner) throws Exception {
34+
runner.runYamsql(PREFIX + "/with-documentation-queries.yamsql");
35+
}
36+
37+
@TestTemplate
38+
void castDocumentationQueriesTests(YamlTest.Runner runner) throws Exception {
39+
runner.runYamsql(PREFIX + "/cast-documentation-queries.yamsql");
40+
}
41+
42+
@TestTemplate
43+
void vectorDocumentationQueriesTests(YamlTest.Runner runner) throws Exception {
44+
runner.runYamsql(PREFIX + "/vector-documentation-queries.yamsql");
45+
}
46+
47+
@TestTemplate
48+
void aggregateFunctionsDocumentationQueriesTests(YamlTest.Runner runner) throws Exception {
49+
runner.runYamsql(PREFIX + "/aggregate-functions-documentation-queries.yamsql");
50+
}
51+
52+
@TestTemplate
53+
void scalarFunctionsDocumentationQueriesTests(YamlTest.Runner runner) throws Exception {
54+
runner.runYamsql(PREFIX + "/scalar-functions-documentation-queries.yamsql");
55+
}
56+
}

yaml-tests/src/test/resources/documentation-queries/aggregate-functions-documentation-queries.yamsql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ options:
44
---
55
schema_template:
66
create table sales(id bigint, product string, region string, amount bigint, primary key(id))
7+
create index product_idx as select product from sales order by product
8+
create index region_idx as select region from sales order by region
79
---
810
setup:
911
steps:

0 commit comments

Comments
 (0)