aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/public/purecalc/ut/test_langver.cpp
blob: 1b3cfa2ff46d79746d5dcb6e7b33372338250ba1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <yql/essentials/public/purecalc/purecalc.h>
#include <yql/essentials/public/purecalc/io_specs/protobuf/spec.h>
#include <yql/essentials/public/purecalc/ut/protos/test_structs.pb.h>
#include <yql/essentials/public/purecalc/ut/empty_stream.h>

#include <library/cpp/testing/unittest/registar.h>

#include "fake_spec.h"

Y_UNIT_TEST_SUITE(TestLangVer) {
    Y_UNIT_TEST(TooHighLangVer) {
        using namespace NYql::NPureCalc;

        auto options = TProgramFactoryOptions();
        options.SetLanguageVersion(NYql::GetMaxLangVersion());
        auto factory = MakeProgramFactory(options);

        try {
            auto sql = TString(R"(
                SELECT * FROM Input;
            )");

            factory->MakePullStreamProgram(FakeIS(), FakeOS(), sql, ETranslationMode::SQL);
            UNIT_FAIL("Exception is expected");
        } catch (const TCompileError& e) {
            UNIT_ASSERT_C(e.GetIssues().Contains("version"), e.GetIssues());
        }
    }
}