Skip to content

Commit ecd1982

Browse files
committed
Add tests
1 parent 5c195f8 commit ecd1982

File tree

3 files changed

+97
-3
lines changed

3 files changed

+97
-3
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From cfce089822412b142ae1e578111e650d85e64bf7 Mon Sep 17 00:00:00 2001
2+
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
3+
Date: Wed, 18 Jun 2025 18:45:34 +0000
4+
Subject: [PATCH] Import directory diff for patch generation
5+
6+
---
7+
net/minecraft/network/chat/Component.java | 2 +-
8+
net/minecraft/server/network/ServerConnectionListener.java | 2 +-
9+
2 files changed, 2 insertions(+), 2 deletions(-)
10+
11+
diff --git a/net/minecraft/network/chat/Component.java b/net/minecraft/network/chat/Component.java
12+
index c6e4f72..4cebf32 100644
13+
--- a/net/minecraft/network/chat/Component.java
14+
+++ b/net/minecraft/network/chat/Component.java
15+
@@ -39,7 +39,7 @@ import net.minecraft.world.level.ChunkPos;
16+
17+
public interface Component extends Message, FormattedText, Iterable<Component> { // CraftBukkit
18+
19+
- // CraftBukkit start
20+
+ // CraftBukkit start - SUPER complicated change
21+
default java.util.stream.Stream<Component> stream() {
22+
return com.google.common.collect.Streams.concat(java.util.stream.Stream.of(this), this.getSiblings().stream().flatMap(Component::stream));
23+
}
24+
diff --git a/net/minecraft/server/network/ServerConnectionListener.java b/net/minecraft/server/network/ServerConnectionListener.java
25+
index bd07e6a..cd7a5e4 100644
26+
--- a/net/minecraft/server/network/ServerConnectionListener.java
27+
+++ b/net/minecraft/server/network/ServerConnectionListener.java
28+
@@ -108,7 +108,7 @@ public class ServerConnectionListener {
29+
LOGGER.warn("Using HAProxy, please ensure the server port is adequately firewalled.");
30+
}
31+
// Paper end - Warn people with console access that HAProxy is in use.
32+
- // Paper start - Use Velocity cipher
33+
+ // Paper start - Use Velocity cipher huge diff
34+
ServerConnectionListener.LOGGER.info("Paper: Using " + com.velocitypowered.natives.util.Natives.compress.getLoadedVariant() + " compression from Velocity.");
35+
ServerConnectionListener.LOGGER.info("Paper: Using " + com.velocitypowered.natives.util.Natives.cipher.getLoadedVariant() + " cipher from Velocity.");
36+
// Paper end - Use Velocity cipher
37+
--
38+
2.49.0
39+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
From 3515151127e2cc0ac72f30a7c178a4ed73f31f90 Mon Sep 17 00:00:00 2001
2+
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
3+
Date: Wed, 18 Jun 2025 19:30:57 +0000
4+
Subject: [PATCH] Import directory diff for patch generation
5+
6+
---
7+
net/minecraft/network/chat/Component.java | 2 +-
8+
net/minecraft/server/network/ServerConnectionListener.java | 2 +-
9+
2 files changed, 2 insertions(+), 2 deletions(-)
10+
11+
diff --git a/net/minecraft/network/chat/Component.java b/net/minecraft/network/chat/Component.java
12+
index c6e4f72..4cebf32 100644
13+
--- a/net/minecraft/network/chat/Component.java
14+
+++ b/net/minecraft/network/chat/Component.java
15+
@@ -39,7 +39,7 @@ import net.minecraft.world.level.ChunkPos;
16+
17+
public interface Component extends Message, FormattedText, Iterable<Component> { // CraftBukkit
18+
19+
- // CraftBukkit start
20+
+ // CraftBukkit start - SUPER complicated change
21+
default java.util.stream.Stream<Component> stream() {
22+
return com.google.common.collect.Streams.concat(java.util.stream.Stream.of(this), this.getSiblings().stream().flatMap(Component::stream));
23+
}
24+
diff --git a/net/minecraft/server/network/ServerConnectionListener.java b/net/minecraft/server/network/ServerConnectionListener.java
25+
index bd07e6a..cd7a5e4 100644
26+
--- a/net/minecraft/server/network/ServerConnectionListener.java
27+
+++ b/net/minecraft/server/network/ServerConnectionListener.java
28+
@@ -108,7 +108,7 @@ public class ServerConnectionListener {
29+
LOGGER.warn("Using HAProxy, please ensure the server port is adequately firewalled.");
30+
}
31+
// Paper end - Warn people with console access that HAProxy is in use.
32+
- // Paper start - Use Velocity cipher
33+
+ // Paper start - Use Velocity cipher huge diff
34+
ServerConnectionListener.LOGGER.info("Paper: Using " + com.velocitypowered.natives.util.Natives.compress.getLoadedVariant() + " compression from Velocity.");
35+
ServerConnectionListener.LOGGER.info("Paper: Using " + com.velocitypowered.natives.util.Natives.cipher.getLoadedVariant() + " cipher from Velocity.");
36+
// Paper end - Use Velocity cipher

web/src/test/util.test.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
import { expect, test } from "vitest";
2+
import {splitMultiFilePatch} from "$lib/util";
3+
import * as path from "node:path";
4+
import * as fs from "node:fs";
25

3-
// TODO add real test
4-
test("adds 1 + 2 to equal 3", () => {
5-
expect(1 + 2).toBe(3);
6+
test("Yield 2 patches from a patch file with signature", () => {
7+
const patch = loadPatch('patch-with-signature.patch');
8+
expect(splitMultiFilePatch(patch).length).toBe(2);
69
});
10+
11+
12+
test("Yield 2 patches from a patch file without signature", () => {
13+
const patch = loadPatch('patch-without-signature.patch');
14+
expect(splitMultiFilePatch(patch).length).toBe(2);
15+
});
16+
17+
18+
export function loadPatch(name: string): string {
19+
const filePath = path.resolve(__dirname, "patches", name);
20+
21+
return fs.readFileSync(
22+
filePath,
23+
'utf8'
24+
);
25+
}

0 commit comments

Comments
 (0)