@@ -258,7 +258,7 @@ let x = MyClass()
258
258
( fun ( obsoleteDiagnostic : ObsoleteDiagnosticExtendedData ) ->
259
259
Assert.Equal( " FS222" , obsoleteDiagnostic.DiagnosticId)
260
260
Assert.Equal( " https://example.com" , obsoleteDiagnostic.UrlFormat))
261
-
261
+
262
262
[<Fact>]
263
263
let ``Warning - ObsoleteDiagnosticExtendedData 02`` () =
264
264
FSharp """
@@ -307,6 +307,176 @@ let x = MyClass()
307
307
Assert.Equal( " FS222" , obsoleteDiagnostic.DiagnosticId)
308
308
Assert.Equal( " https://example.com" , obsoleteDiagnostic.UrlFormat))
309
309
310
+
311
+ [<Fact>]
312
+ let ``Warning - ObsoleteDiagnosticExtendedData 05`` () =
313
+ let CSLib =
314
+ CSharp """
315
+ using System;
316
+ [Obsolete("Use something else", false, DiagnosticId = "FS222")]
317
+ public static class Class1
318
+ {
319
+ public static string Test()
320
+ {
321
+ return "Hello";
322
+ }
323
+ }
324
+ """
325
+ |> withName " CSLib"
326
+
327
+ let app =
328
+ FSharp """
329
+ open MyLib
330
+
331
+ let text = Class1.Test();
332
+ """ |> withReferences [ CSLib]
333
+
334
+ app
335
+ |> typecheckResults
336
+ |> checkDiagnostic
337
+ ( 44 , " This construct is deprecated. Use something else" )
338
+ ( fun ( obsoleteDiagnostic : ObsoleteDiagnosticExtendedData ) ->
339
+ Assert.Equal( " FS222" , obsoleteDiagnostic.DiagnosticId)
340
+ Assert.Equal( " " , obsoleteDiagnostic.UrlFormat))
341
+
342
+ [<Fact>]
343
+ let ``Warning - ObsoleteDiagnosticExtendedData 06`` () =
344
+ let CSLib =
345
+ CSharp """
346
+ using System;
347
+ [Obsolete("Use something else", false, DiagnosticId = "FS222", UrlFormat = "https://example.com")]
348
+ public static class Class1
349
+ {
350
+ public static string Test()
351
+ {
352
+ return "Hello";
353
+ }
354
+ }
355
+ """
356
+ |> withName " CSLib"
357
+
358
+ let app =
359
+ FSharp """
360
+ open MyLib
361
+
362
+ let text = Class1.Test();
363
+ """ |> withReferences [ CSLib]
364
+
365
+ app
366
+ |> typecheckResults
367
+ |> checkDiagnostic
368
+ ( 44 , " This construct is deprecated. Use something else" )
369
+ ( fun ( obsoleteDiagnostic : ObsoleteDiagnosticExtendedData ) ->
370
+ Assert.Equal( " FS222" , obsoleteDiagnostic.DiagnosticId)
371
+ Assert.Equal( " https://example.com" , obsoleteDiagnostic.UrlFormat))
372
+
373
+ [<Fact>]
374
+ let ``Warning - ObsoleteDiagnosticExtendedData 07`` () =
375
+ let CSLib =
376
+ CSharp """
377
+ using System;
378
+ [Obsolete("Use something else", false)]
379
+ public static class Class1
380
+ {
381
+ public static string Test()
382
+ {
383
+ return "Hello";
384
+ }
385
+ }
386
+ """
387
+ |> withName " CSLib"
388
+
389
+ let app =
390
+ FSharp """
391
+ open MyLib
392
+
393
+ let text = Class1.Test();
394
+ """ |> withReferences [ CSLib]
395
+
396
+ app
397
+ |> typecheckResults
398
+ |> checkDiagnostic
399
+ ( 44 , " This construct is deprecated. Use something else" )
400
+ ( fun ( obsoleteDiagnostic : ObsoleteDiagnosticExtendedData ) ->
401
+ Assert.Equal( " " , obsoleteDiagnostic.DiagnosticId)
402
+ Assert.Equal( " " , obsoleteDiagnostic.UrlFormat))
403
+
404
+ [<Fact>]
405
+ let ``Warning - ObsoleteDiagnosticExtendedData 08`` () =
406
+ let CSLib =
407
+ CSharp """
408
+ using System;
409
+ [Obsolete(DiagnosticId = "FS222", UrlFormat = "https://example.com")]
410
+ public static class Class1
411
+ {
412
+ public static string Test()
413
+ {
414
+ return "Hello";
415
+ }
416
+ }
417
+ """
418
+ |> withName " CSLib"
419
+
420
+ let app =
421
+ FSharp """
422
+ open MyLib
423
+
424
+ let text = Class1.Test();
425
+ """ |> withReferences [ CSLib]
426
+
427
+ app
428
+ |> typecheckResults
429
+ |> checkDiagnostic
430
+ ( 44 , " This construct is deprecated" )
431
+ ( fun ( obsoleteDiagnostic : ObsoleteDiagnosticExtendedData ) ->
432
+ Assert.Equal( " FS222" , obsoleteDiagnostic.DiagnosticId)
433
+ Assert.Equal( " https://example.com" , obsoleteDiagnostic.UrlFormat))
434
+
435
+ [<Fact>]
436
+ let ``Warning - ObsoleteDiagnosticExtendedData 09`` () =
437
+ FSharp """
438
+ open System
439
+ [<Obsolete>]
440
+ type MyClass() = class end
441
+
442
+ let x = MyClass()
443
+ """
444
+ |> typecheckResults
445
+ |> checkDiagnostic
446
+ ( 44 , " This construct is deprecated" )
447
+ ( fun ( obsoleteDiagnostic : ObsoleteDiagnosticExtendedData ) ->
448
+ Assert.Equal( " " , obsoleteDiagnostic.DiagnosticId)
449
+ Assert.Equal( " " , obsoleteDiagnostic.UrlFormat))
450
+
451
+ let ``Warning - ObsoleteDiagnosticExtendedData 10`` () =
452
+ let CSLib =
453
+ CSharp """
454
+ using System;
455
+ [Obsolete]
456
+ public static class Class1
457
+ {
458
+ public static string Test()
459
+ {
460
+ return "Hello";
461
+ }
462
+ }
463
+ """
464
+ |> withName " CSLib"
465
+
466
+ let app =
467
+ FSharp """
468
+ open MyLib
469
+
470
+ let text = Class1.Test();
471
+ """ |> withReferences [ CSLib]
472
+
473
+ app
474
+ |> typecheckResults
475
+ |> checkDiagnostic
476
+ ( 44 , " This construct is deprecated" )
477
+ ( fun ( obsoleteDiagnostic : ObsoleteDiagnosticExtendedData ) ->
478
+ Assert.Equal( " " , obsoleteDiagnostic.DiagnosticId)
479
+ Assert.Equal( " " , obsoleteDiagnostic.UrlFormat))
310
480
311
481
[<Fact>]
312
482
let ``Error - ObsoleteDiagnosticExtendedData 01`` () =
0 commit comments