commit ffdc632ea1d21685a6bfbf410dc87b2fe3b6552d
parent 132567c71f41e699a76305c597b18ef1b456bb1b
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu, 4 Dec 2025 08:27:57 +0800
vim-patch:9.1.1952: tests: need better tests for tf files
Problem: tests: need better tests for tf files
Solution: Add better filetype test for terraform/tf filetype
closes: vim/vim#18339
https://github.com/vim/vim/commit/23f23e611fcfb8a74ba4f09a23bda8eaaddfe585
Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat:
1 file changed, 43 insertions(+), 0 deletions(-)
diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim
@@ -2351,6 +2351,49 @@ func Test_tf_file()
filetype off
endfunc
+func Test_tf_file_v2()
+ filetype on
+
+ let lines =<< trim END
+ ;# Connect to a MUD server
+ /server mud.example.com 4000
+ ;set verbose on
+ /def greet = /echo Hello, $[name()]
+ /def hp = /send score
+ ;alias n = north
+ ;alias s = south
+ ;set autolog on
+ /def prompt = /echo -p Prompt: %{*}
+ END
+
+ call writefile(lines, "Xfile.tf", "D")
+ split Xfile.tf
+ call assert_equal('tf', &filetype)
+ bw!
+ let lines =<< trim END
+ # This is a comment at the top of the file
+
+ terraform {
+ required_version = ">= 1.0"
+ }
+
+ provider "aws" {
+ region = "us-east-1"
+ }
+
+ resource "aws_s3_bucket" "demo" {
+ bucket = "example-bucket"
+ }
+ END
+ call writefile(lines, "Xfile.tf", "D")
+ split Xfile.tf
+ call assert_equal('terraform', &filetype)
+ bwipe!
+
+ filetype off
+endfunc
+
+
func Test_ts_file()
filetype on