@@ -11,13 +11,15 @@ type TestConventionsDiscourageStringInterpolationWithStringFormat() =
1111 [<Test>]
1212 member this.StringInterpolationWithSprintfShouldNotProduceError () =
1313 this.Parse """
14+ let world = "world"
1415let someString = sprintf "Hello %s " world"""
1516
1617 Assert.IsTrue this.NoErrorsExist
1718
1819 [<Test>]
1920 member this.StringInterpolationWithStringFormatShouldProduceError () =
2021 this.Parse """
22+ let world = "world"
2123let someString = String.Format("Hello {0}", world)"""
2224
2325 Assert.IsTrue this.ErrorsExist
@@ -35,6 +37,7 @@ let someFunction someTemplate =
3537 [<Test>]
3638 member this.StringInterpolationWithStringFormatAndLocalVariableShouldProduceError () =
3739 this.Parse """
40+ let world = "world"
3841let someTemplate = "Hello {0}"
3942let someString = String.Format(someTemplate, world)"""
4043
@@ -45,9 +48,10 @@ let someString = String.Format(someTemplate, world)"""
4548 member this.StringInterpolationWithMultipleModuleWithSameVariableNameShouldNotProduceError () =
4649 this.Parse """
4750module Foo =
48- let someTemplate = "Hello, this is not for String.Format actually "
51+ let someTemplate = "Hello {0} "
4952module Bar =
5053 let someFunction someTemplate =
54+ let world = "world"
5155 Console.WriteLine(String.Format(someTemplate, "world"))"""
5256
5357 Assert.IsTrue this.NoErrorsExist
@@ -58,11 +62,12 @@ module Bar =
5862 this.Parse """
5963module Bar =
6064 let exampleFunction () =
61- let someTemplate = "Hello, this is not for String.Format actually "
65+ let someTemplate = "Hello {0} "
6266 someTemplate
6367 let someFunction someTemplate =
64- let returnConstInt () =
65- 89
68+ let someNestedFunc () =
69+ 1
70+ let world = "world"
6671 Console.WriteLine(String.Format(someTemplate, "world"))"""
6772
6873 Assert.IsTrue this.NoErrorsExist
@@ -74,8 +79,9 @@ module Bar =
7479module Bar =
7580 let exampleFunction someTemplate =
7681 let someResults =
77- let someTemplate = "Hello, this is not for String.Format actually "
82+ let someTemplate = "Hello {0} "
7883 someTemplate
84+ let world = "world"
7985 Console.WriteLine(String.Format(someTemplate, "world"))"""
8086
8187 Assert.IsTrue this.NoErrorsExist
0 commit comments