diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:06:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:06:31 +0000 |
commit | 2ff14448863ac1a1dd9533461708e29aae170c2d (patch) | |
tree | 85b9fea2bbfe3f06473cfa381eed11f273b57c5c /src/test/run-make/translation | |
parent | Adding debian version 1.64.0+dfsg1-1. (diff) | |
download | rustc-2ff14448863ac1a1dd9533461708e29aae170c2d.tar.xz rustc-2ff14448863ac1a1dd9533461708e29aae170c2d.zip |
Adding debian version 1.65.0+dfsg1-2.debian/1.65.0+dfsg1-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/run-make/translation')
-rw-r--r-- | src/test/run-make/translation/Makefile | 25 | ||||
-rw-r--r-- | src/test/run-make/translation/basic-translation.ftl | 2 | ||||
-rw-r--r-- | src/test/run-make/translation/broken.ftl | 3 | ||||
-rw-r--r-- | src/test/run-make/translation/missing.ftl | 3 | ||||
-rw-r--r-- | src/test/run-make/translation/test.rs (renamed from src/test/run-make/translation/basic-translation.rs) | 0 | ||||
-rw-r--r-- | src/test/run-make/translation/working.ftl | 2 |
6 files changed, 27 insertions, 8 deletions
diff --git a/src/test/run-make/translation/Makefile b/src/test/run-make/translation/Makefile index bfff75e7a..20e86c7f9 100644 --- a/src/test/run-make/translation/Makefile +++ b/src/test/run-make/translation/Makefile @@ -9,16 +9,29 @@ FAKEROOT=$(TMPDIR)/fakeroot all: normal custom sysroot -normal: basic-translation.rs +# Check that the test works normally, using the built-in fallback bundle. +normal: test.rs $(RUSTC) $< 2>&1 | grep "struct literal body without path" -custom: basic-translation.rs basic-translation.ftl - $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/basic-translation.ftl 2>&1 | grep "this is a test message" +# Check that a primary bundle can be loaded and will be preferentially used +# where possible. +custom: test.rs working.ftl + $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/working.ftl 2>&1 | grep "this is a test message" + +# Check that a primary bundle with a broken message (e.g. a interpolated +# variable is missing) will use the fallback bundle. +missing: test.rs missing.ftl + $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/missing.ftl 2>&1 | grep "struct literal body without path" + +# Check that a primary bundle without the desired message will use the fallback +# bundle. +broken: test.rs broken.ftl + $(RUSTC) $< -Ztranslate-additional-ftl=$(CURDIR)/broken.ftl 2>&1 | grep "struct literal body without path" # Check that a locale can be loaded from the sysroot given a language # identifier by making a local copy of the sysroot and adding the custom locale # to it. -sysroot: basic-translation.rs basic-translation.ftl +sysroot: test.rs working.ftl mkdir $(FAKEROOT) ln -s $(SYSROOT)/* $(FAKEROOT) rm -f $(FAKEROOT)/lib @@ -31,7 +44,7 @@ sysroot: basic-translation.rs basic-translation.ftl mkdir $(FAKEROOT)/lib/rustlib/src ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src mkdir -p $(FAKEROOT)/share/locale/zh-CN/ - ln -s $(CURDIR)/basic-translation.ftl $(FAKEROOT)/share/locale/zh-CN/basic-translation.ftl + ln -s $(CURDIR)/working.ftl $(FAKEROOT)/share/locale/zh-CN/basic-translation.ftl $(RUSTC) $< --sysroot $(FAKEROOT) -Ztranslate-lang=zh-CN 2>&1 | grep "this is a test message" # Check that the compiler errors out when the sysroot requested cannot be @@ -43,7 +56,7 @@ sysroot-missing: # Check that the compiler errors out when the sysroot requested cannot be # found. This test might start failing if there actually exists a Klingon # translation of rustc's error messages. -sysroot-invalid: basic-translation.rs basic-translation.ftl +sysroot-invalid: test.rs working.ftl mkdir $(FAKEROOT) ln -s $(SYSROOT)/* $(FAKEROOT) rm -f $(FAKEROOT)/lib diff --git a/src/test/run-make/translation/basic-translation.ftl b/src/test/run-make/translation/basic-translation.ftl deleted file mode 100644 index 4681b879c..000000000 --- a/src/test/run-make/translation/basic-translation.ftl +++ /dev/null @@ -1,2 +0,0 @@ -parser-struct-literal-body-without-path = this is a test message - .suggestion = this is a test suggestion diff --git a/src/test/run-make/translation/broken.ftl b/src/test/run-make/translation/broken.ftl new file mode 100644 index 000000000..4e3585835 --- /dev/null +++ b/src/test/run-make/translation/broken.ftl @@ -0,0 +1,3 @@ +# `foo` isn't provided by this diagnostic so it is expected that the fallback message is used. +parser_struct_literal_body_without_path = this is a {$foo} message + .suggestion = this is a test suggestion diff --git a/src/test/run-make/translation/missing.ftl b/src/test/run-make/translation/missing.ftl new file mode 100644 index 000000000..77bbda357 --- /dev/null +++ b/src/test/run-make/translation/missing.ftl @@ -0,0 +1,3 @@ +# `parser_struct_literal_body_without_path` isn't provided by this resource at all, so the +# fallback should be used. +foo = bar diff --git a/src/test/run-make/translation/basic-translation.rs b/src/test/run-make/translation/test.rs index b8f5bff31..b8f5bff31 100644 --- a/src/test/run-make/translation/basic-translation.rs +++ b/src/test/run-make/translation/test.rs diff --git a/src/test/run-make/translation/working.ftl b/src/test/run-make/translation/working.ftl new file mode 100644 index 000000000..d5ea86738 --- /dev/null +++ b/src/test/run-make/translation/working.ftl @@ -0,0 +1,2 @@ +parser_struct_literal_body_without_path = this is a test message + .suggestion = this is a test suggestion |