@@ -27,7 +27,7 @@ module Collections =
2727
2828 #if TEST_ TRACE
2929 CollectionAssert.AreEqual ([ " ChunkBy, list<'T>" ], Traces.get())
30- #endif
30+ #endif
3131
3232
3333 let testCollections =
@@ -52,6 +52,11 @@ module Collections =
5252
5353
5454 let testSeqConversions =
55+
56+ #if TEST_ TRACE
57+ Traces.reset()
58+ #endif
59+
5560 let sk : Generic.Stack < _ > = ofSeq { 1 .. 3 }
5661 let sg : string = ofSeq { '1' .. '3' } // but it will come back as seq<char>
5762 let sb : Text.StringBuilder = ofSeq { '1' .. '3' } // but it will come back as seq<char>
@@ -76,12 +81,29 @@ module Collections =
7681 let _r : IReadOnlyDictionary < _ , _ > = ofSeq ( seq [ KeyValuePair( 1 , " One" ); KeyValuePair( 2 , " Two" )])
7782 let rc : IReadOnlyCollection < _ > = ofSeq ( seq [ 2 .. 7 ])
7883 let ut : Hashtable = ofSeq ( seq [ 1 , '1' ; 2 , '2' ; 3 , '3' ]) // but it will come back as seq<obj>
84+
85+ #if TEST_ TRACE
86+ CollectionAssert.AreEqual ([], Traces.get())
87+ #endif
88+
7989 let al : ArrayList = ofSeq ( seq [ " 1" ; " 2" ; " 3" ]) // but it will come back as seq<obj>
80- let us : SortedList = ofSeq ( seq [ 4 , '2' ; 3 , '4' ]) // but it will come back as seq<obj>
90+ #if TEST_ TRACE
91+ CollectionAssert.AreEqual ([ " OfSeq, Default2-#Add" ], Traces.get())
92+ #endif
93+
8194 let cc : BlockingCollection < _ > = ofSeq { '1' .. '3' } // but it will come back as seq<obj>
95+ #if TEST_ TRACE
96+ CollectionAssert.AreEqual ([ " OfSeq, Default2-#Add" ; " OfSeq, Default2-#Add" ], Traces.get())
97+ #endif
98+
99+ let cb : ConcurrentBag < _ > = ofSeq { '1' .. '3' }
100+ #if TEST_ TRACE
101+ CollectionAssert.AreEqual ([ " OfSeq, Default2-#Add" ; " OfSeq, Default2-#Add" ; " OfSeq, Default2-#Add" ], Traces.get())
102+ #endif
103+
104+ let us : SortedList = ofSeq ( seq [ 4 , '2' ; 3 , '4' ]) // but it will come back as seq<obj>
82105 let cd : ConcurrentDictionary < _ , _ > = ofSeq ( seq [( 1 , " One" ); ( 2 , " Two" )]) // but it will come back as ...
83106 let _cd : ConcurrentDictionary < _ , _ > = ofSeq ( seq [ KeyValuePair( 1 , " One" ); KeyValuePair( 2 , " Two" )])
84- let cb : ConcurrentBag < _ > = ofSeq { '1' .. '3' }
85107
86108 // now go back
87109 let _sk ' = toSeq sk
@@ -119,7 +141,15 @@ module Collections =
119141 let _cols = columns |> toList |> map ( fun x -> x.ColumnName)
120142
121143 // Defaults
144+
145+ #if TEST_ TRACE
146+ CollectionAssert.AreEqual ([ " OfSeq, Default2-#Add" ; " OfSeq, Default2-#Add" ; " OfSeq, Default2-#Add" ], Traces.get())
147+ #endif
148+
122149 let _12 : WrappedListI < _ > = seq [ 1 ; 2 ] |> ofSeq
150+ #if TEST_ TRACE
151+ CollectionAssert.AreEqual ([ " OfSeq, Default2-#Add" ; " OfSeq, Default2-#Add" ; " OfSeq, Default2-#Add" ; " OfSeq, Default4-seq<'t>" ], Traces.get())
152+ #endif
123153
124154 ()
125155
@@ -150,12 +180,30 @@ module Collections =
150180 let _r : IReadOnlyDictionary < _ , _ > = ofList ([ KeyValuePair( 1 , " One" ); KeyValuePair( 2 , " Two" )])
151181 let rc : IReadOnlyCollection < _ > = ofList ([ 2 .. 5 ])
152182 let ut : Hashtable = ofList ([ 1 , '1' ; 2 , '2' ; 3 , '3' ]) // but it will come back as seq<obj>
183+
184+ #if TEST_ TRACE
185+ CollectionAssert.AreEqual ([], Traces.get())
186+ #endif
187+
153188 let al : ArrayList = ofList ([ " 1" ; " 2" ; " 3" ]) // but it will come back as seq<obj>
189+ #if TEST_ TRACE
190+ CollectionAssert.AreEqual ([ " OfList, Default2-#Add" ], Traces.get())
191+ #endif
192+
193+ let cc : BlockingCollection < _ > = ofList [ '1' .. '3' ] // but it will come back as seq<obj>
194+ #if TEST_ TRACE
195+ CollectionAssert.AreEqual ([ " OfList, Default2-#Add" ; " OfSeq, Default2-#Add" ], Traces.get())
196+ #endif
197+
198+ let cb : ConcurrentBag < _ > = ofList [ '1' .. '3' ]
199+ #if TEST_ TRACE
200+ CollectionAssert.AreEqual ([ " OfList, Default2-#Add" ; " OfSeq, Default2-#Add" ; " OfSeq, Default2-#Add" ], Traces.get())
201+ #endif
202+
203+
154204 let us : SortedList = ofList ([ 4 , '2' ; 3 , '4' ]) // but it will come back as seq<obj>
155- let cc : BlockingCollection < _ > = ofList [ '1' .. '3' ] // but it will come back as seq<obj>
156205 let cd : ConcurrentDictionary < _ , _ > = ofList ([( 1 , " One" ); ( 2 , " Two" )]) // but it will come back as ...
157206 let _cd : ConcurrentDictionary < _ , _ > = ofList ([ KeyValuePair( 1 , " One" ); KeyValuePair( 2 , " Two" )])
158- let cb : ConcurrentBag < _ > = ofList [ '1' .. '3' ]
159207
160208 // now go back
161209 let _sk ' = toList sk
0 commit comments