Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump the baseline group in /impl/baseline with 6 updates #243

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
367 changes: 136 additions & 231 deletions impl/baseline/gen/conformance/conformance_pb.ts

Large diffs are not rendered by default.

1,430 changes: 433 additions & 997 deletions impl/baseline/gen/google/protobuf/test_messages_proto2_pb.ts

Large diffs are not rendered by default.

708 changes: 233 additions & 475 deletions impl/baseline/gen/google/protobuf/test_messages_proto3_pb.ts

Large diffs are not rendered by default.

146 changes: 74 additions & 72 deletions impl/baseline/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions impl/baseline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"private": true,
"type": "module",
"dependencies": {
"@bufbuild/protobuf": "^1.10.0",
"@bufbuild/protoc-gen-es": "^1.10.0"
"@bufbuild/protobuf": "^2.0.0",
"@bufbuild/protoc-gen-es": "^2.0.0"
},
"devDependencies": {
"@bufbuild/buf": "^1.34.0",
"@types/node": "^20.14.9",
"tsx": "^4.16.0",
"typescript": "^5.5.2"
"@bufbuild/buf": "^1.35.1",
"@types/node": "^22.0.2",
"tsx": "^4.16.4",
"typescript": "^5.5.4"
}
}
32 changes: 19 additions & 13 deletions impl/baseline/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { create, fromBinary, toBinary } from "@bufbuild/protobuf";
import {
ConformanceRequest,
ConformanceResponse,
FailureSet,
type ConformanceRequest,
ConformanceRequestSchema,
type ConformanceResponse,
ConformanceResponseSchema,
FailureSetSchema,
} from "./gen/conformance/conformance_pb.js";
import { readSync, writeSync } from "fs";

Expand All @@ -29,30 +32,33 @@ function main() {
}
} catch (e) {
process.stderr.write(
`conformance.ts: exiting after ${testCount} tests: ${String(e)}`
`conformance.ts: exiting after ${testCount} tests: ${String(e)}`,
);
process.exit(1);
}
}

function test(request: ConformanceRequest): ConformanceResponse["result"] {
if (request.messageType === FailureSet.typeName) {
if (request.messageType === FailureSetSchema.typeName) {
// > The conformance runner will request a list of failures as the first request.
// > This will be known by message_type == "conformance.FailureSet", a conformance
// > test should return a serialized FailureSet in protobuf_payload.
const failureSet = new FailureSet();
return { case: "protobufPayload", value: failureSet.toBinary() };
const failureSet = create(FailureSetSchema);
return {
case: "protobufPayload",
value: toBinary(FailureSetSchema, failureSet),
};
}
return {
case: "runtimeError",
value: "not implemented"
value: "not implemented",
};
}

// Returns true if the test ran successfully, false on legitimate EOF.
// If EOF is encountered in an unexpected place, raises IOError.
function testIo(
test: (request: ConformanceRequest) => ConformanceResponse["result"]
test: (request: ConformanceRequest) => ConformanceResponse["result"],
): boolean {
setBlockingStdout();
const requestLengthBuf = readBuffer(4);
Expand All @@ -64,10 +70,10 @@ function testIo(
if (serializedRequest === "EOF") {
throw "Failed to read request.";
}
const request = ConformanceRequest.fromBinary(serializedRequest);
const response = new ConformanceResponse();
const request = fromBinary(ConformanceRequestSchema, serializedRequest);
const response = create(ConformanceResponseSchema);
response.result = test(request);
const serializedResponse = response.toBinary();
const serializedResponse = toBinary(ConformanceResponseSchema, response);
const responseLengthBuf = Buffer.alloc(4);
responseLengthBuf.writeInt32LE(serializedResponse.length, 0);
writeBuffer(responseLengthBuf);
Expand Down Expand Up @@ -101,7 +107,7 @@ function writeBuffer(buffer: Buffer): void {
1,
buffer,
totalWritten,
buffer.length - totalWritten
buffer.length - totalWritten,
);
}
}
Expand Down
Loading