runtime(indent-tests): Include a simple Rust indent test
Commit:
https://github.com/vim/vim/commit/ea2b98b9e901a7a302100857d07d75233f2a0fb2
Author: Christian Brabandt <[email protected]>
Date: Sun Dec 28 14:00:44 2025 +0000
runtime(indent-tests): Include a simple Rust indent test
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/indent/testdir/rust.in b/runtime/indent/testdir/rust.in
new file mode 100644
index 000000000..848912bfb
--- /dev/null
+++ b/runtime/indent/testdir/rust.in
@@ -0,0 +1,27 @@
+// vim: set ft=rust ts=8 sw=4 sts=4 et :
+// START_INDENT
+use std::fs::File;
+use std::io::prelude::*;
+use std::path::Path;
+
+fn main() {
+ // Create a path to the desired file
+ let path = Path::new("hello.txt");
+ let display = path.display();
+
+ // Open the path in read-only mode, returns `io::Result<File>`
+ let mut file = match File::open(&path) {
+ Err(why) => panic!("couldn't open {}: {}", display, why),
+ Ok(file) => file,
+ };
+
+ // Read the file contents into a string, returns `io::Result<usize>`
+ let mut s = String::new();
+ match file.read_to_string(&mut s) {
+ Err(why) => panic!("couldn't read {}: {}", display, why),
+ Ok(_) => print!("{} contains:
{}", display, s),
+ }
+
+ // file goes out of scope, and the "hello.txt" file gets closed
+}
+// END_INDENT
diff --git a/runtime/indent/testdir/rust.ok b/runtime/indent/testdir/rust.ok
new file mode 100644
index 000000000..ea2a071b0
--- /dev/null
+++ b/runtime/indent/testdir/rust.ok
@@ -0,0 +1,27 @@
+// vim: set ft=rust ts=8 sw=4 sts=4 et :
+// START_INDENT
+use std::fs::File;
+use std::io::prelude::*;
+use std::path::Path;
+
+fn main() {
+ // Create a path to the desired file
+ let path = Path::new("hello.txt");
+ let display = path.display();
+
+ // Open the path in read-only mode, returns `io::Result<File>`
+ let mut file = match File::open(&path) {
+ Err(why) => panic!("couldn't open {}: {}", display, why),
+ Ok(file) => file,
+ };
+
+ // Read the file contents into a string, returns `io::Result<usize>`
+ let mut s = String::new();
+ match file.read_to_string(&mut s) {
+ Err(why) => panic!("couldn't read {}: {}", display, why),
+ Ok(_) => print!("{} contains:
{}", display, s),
+ }
+
+ // file goes out of scope, and the "hello.txt" file gets closed
+}
+// END_INDENT
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1vZrY0-002MKI-2A%40256bit.org.