From f4e3aed51ddb6c26cdbcab29a17a5bdba4125087 Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Wed, 24 Apr 2024 10:30:11 +0200 Subject: [PATCH] sync: hello-world --- .../hello-world/.meta/test_template.tera | 9 +++++++++ exercises/practice/hello-world/.meta/tests.toml | 16 +++++++++++++--- .../practice/hello-world/tests/hello-world.rs | 6 ++++-- 3 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 exercises/practice/hello-world/.meta/test_template.tera diff --git a/exercises/practice/hello-world/.meta/test_template.tera b/exercises/practice/hello-world/.meta/test_template.tera new file mode 100644 index 000000000..044044766 --- /dev/null +++ b/exercises/practice/hello-world/.meta/test_template.tera @@ -0,0 +1,9 @@ +use hello_world::*; + +{% for test in cases %} +#[test] +#[ignore] +fn {{ test.description | snake_case }}() { + assert_eq!(hello(), {{ test.expected | json_encode() }}); +} +{% endfor -%} diff --git a/exercises/practice/hello-world/.meta/tests.toml b/exercises/practice/hello-world/.meta/tests.toml index be690e975..73466d677 100644 --- a/exercises/practice/hello-world/.meta/tests.toml +++ b/exercises/practice/hello-world/.meta/tests.toml @@ -1,3 +1,13 @@ -# This is an auto-generated file. Regular comments will be removed when this -# file is regenerated. Regenerating will not touch any manually added keys, -# so comments can be added in a "comment" key. +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. + +[af9ffe10-dc13-42d8-a742-e7bdafac449d] +description = "Say Hi!" diff --git a/exercises/practice/hello-world/tests/hello-world.rs b/exercises/practice/hello-world/tests/hello-world.rs index 7c7bfbaa4..04e2fe1ec 100644 --- a/exercises/practice/hello-world/tests/hello-world.rs +++ b/exercises/practice/hello-world/tests/hello-world.rs @@ -1,4 +1,6 @@ +use hello_world::*; + #[test] -fn hello_world() { - assert_eq!("Hello, World!", hello_world::hello()); +fn say_hi() { + assert_eq!(hello(), "Hello, World!"); }