A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/protocolbuffers/protobuf/commit/a2a051112fc9db0250d7acfb19283c7d1339319f below:

Ban `import weak` and `weak` field option in edition 2024 in protoc (… · protocolbuffers/protobuf@a2a0511 · GitHub

@@ -2203,6 +2203,16 @@ TEST_F(ParseErrorTest, OptionImportBefore2024) {

2203 2203

"2:15: option import is not supported before edition 2024.\n");

2204 2204

}

2205 2205 2206 +

TEST_F(ParseErrorTest, WeakImportAfter2024) {

2207 +

ExpectHasErrors(

2208 +

R"schema(

2209 +

edition = "2024";

2210 +

import weak "foo.proto";

2211 +

)schema",

2212 +

"2:15: weak import is not supported in edition 2024 and above. Consider "

2213 +

"using option import instead.\n");

2214 +

}

2215 + 2206 2216

// ===================================================================

2207 2217

// Test that errors detected by DescriptorPool correctly report line and

2208 2218

// column numbers. We have one test for every call to RecordLocation() in

@@ -3553,25 +3563,44 @@ class SourceInfoTest : public ParserTest {

3553 3563 3554 3564

TEST_F(SourceInfoTest, BasicFileDecls) {

3555 3565

EXPECT_TRUE(

3556 -

Parse("$a$edition = \"2024\";$i$\n"

3566 +

Parse("$a$edition = \"2023\";$i$\n"

3557 3567

"$b$package foo.bar;$c$\n"

3558 3568

"$d$import \"baz.proto\";$e$\n"

3559 3569

"$f$import\"qux.proto\";$h$\n"

3560 3570

"$j$import $k$public$l$ \"bar.proto\";$m$\n"

3561 3571

"$n$import $o$weak$p$ \"bar.proto\";$q$\n"

3562 -

"$r$import option \"bar.proto\";$s$\n"

3563 3572

"\n"

3564 3573

"// comment ignored\n"));

3565 3574 3566 -

EXPECT_TRUE(HasSpan('a', 's', file_));

3575 +

EXPECT_TRUE(HasSpan('a', 'q', file_));

3567 3576

EXPECT_TRUE(HasSpan('b', 'c', file_, "package"));

3568 3577

EXPECT_TRUE(HasSpan('d', 'e', file_, "dependency", 0));

3569 3578

EXPECT_TRUE(HasSpan('f', 'h', file_, "dependency", 1));

3570 3579

EXPECT_TRUE(HasSpan('j', 'm', file_, "dependency", 2));

3571 3580

EXPECT_TRUE(HasSpan('k', 'l', file_, "public_dependency", 0));

3572 3581

EXPECT_TRUE(HasSpan('n', 'q', file_, "dependency", 3));

3573 3582

EXPECT_TRUE(HasSpan('o', 'p', file_, "weak_dependency", 0));

3574 -

EXPECT_TRUE(HasSpan('r', 's', file_, "option_dependency", 0));

3583 +

EXPECT_TRUE(HasSpan('a', 'i', file_, "syntax"));

3584 +

}

3585 + 3586 +

TEST_F(SourceInfoTest, BasicFileDecls_Edition2024) {

3587 +

EXPECT_TRUE(

3588 +

Parse("$a$edition = \"2024\";$i$\n"

3589 +

"$b$package foo.bar;$c$\n"

3590 +

"$d$import \"baz.proto\";$e$\n"

3591 +

"$f$import\"qux.proto\";$h$\n"

3592 +

"$j$import $k$public$l$ \"bar.proto\";$m$\n"

3593 +

"$n$import option \"bar.proto\";$o$\n"

3594 +

"\n"

3595 +

"// comment ignored\n"));

3596 + 3597 +

EXPECT_TRUE(HasSpan('a', 'o', file_));

3598 +

EXPECT_TRUE(HasSpan('b', 'c', file_, "package"));

3599 +

EXPECT_TRUE(HasSpan('d', 'e', file_, "dependency", 0));

3600 +

EXPECT_TRUE(HasSpan('f', 'h', file_, "dependency", 1));

3601 +

EXPECT_TRUE(HasSpan('j', 'm', file_, "dependency", 2));

3602 +

EXPECT_TRUE(HasSpan('k', 'l', file_, "public_dependency", 0));

3603 +

EXPECT_TRUE(HasSpan('n', 'o', file_, "option_dependency", 0));

3575 3604

EXPECT_TRUE(HasSpan('a', 'i', file_, "syntax"));

3576 3605

}

3577 3606

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4