@@ -63,5 +63,31 @@ T["enumerate"] = function()
6363 eq (get_lines (), { " for idx, i in enumerate([1, 2, 3]):" })
6464end
6565
66+ T [" f-string" ] = MiniTest .new_set ({
67+ hooks = {
68+ pre_case = function ()
69+ child .cmd (" e _not_existing_new_buffer.py" )
70+ child .type_keys (" cc" , [[ "TEST"]] , " <Esc>" , " 0" )
71+ end ,
72+ },
73+ })
74+
75+ T [" f-string" ][" insert f string" ] = function ()
76+ child .cmd (" e! _not_existing_new_buffer.py" )
77+ child .type_keys (" cc" , [[ "{foo}"]] , " <Esc>" , " hh" , " i" , " <Esc>" )
78+ eq (get_lines (), { [[ f"{foo}"]] })
79+ end
80+
81+ T [" f-string" ][" skip on r" ] = function ()
82+ child .cmd (" e! _not_existing_new_buffer.py" )
83+ child .type_keys (" cc" , [[ r"{foo}"]] , " <Esc>" , " hh" , " i" , " <Esc>" )
84+ eq (get_lines (), { [[ r"{foo}"]] })
85+ end
86+
87+ T [" f-string" ][" skip on format" ] = function ()
88+ child .cmd (" e! _not_existing_new_buffer.py" )
89+ child .type_keys (" cc" , [[ "{foo}".format()]] , " <Esc>" , " 0lll" , " i" , " <Esc>" )
90+ eq (get_lines (), { [[ "{foo}".format()]] })
91+ end
6692-- Return test set which will be collected and execute inside `MiniTest.run()`
6793return T
0 commit comments