Skip to content

Commit

Permalink
generatestubtests take2
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd committed Nov 23, 2024
1 parent 81b7ea9 commit ebb9c5d
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ open System.IO

let sourceDir = __SOURCE_DIRECTORY__
let expectedTestDir = Path.Join(sourceDir, "GenerateAbstractClassStubTests")

let tfm =
#if NET8_0
"net80"
#else
"net90"
#endif

let expectFile file = File.ReadAllText(Path.Join(expectedTestDir, file))
let tests state =
let config = { defaultConfigDto with AbstractClassStubGeneration = Some true }
Expand Down Expand Up @@ -51,7 +59,7 @@ let tests state =
()"""
(Diagnostics.expectCode "365")
selectCodeFix
(expectFile "can_generate_abstract_class_stub.expected")
(expectFile $"can_generate_abstract_class_stub.{tfm}.expected")

testCaseAsync "can generate abstract class stub with another member with attribute" <|
CodeFix.check server
Expand All @@ -75,7 +83,7 @@ let tests state =
()"""
(Diagnostics.expectCode "365")
selectCodeFix
(expectFile "can_generate_abstract_class_stub_with_another_member_with_attribute.expected")
(expectFile $"can_generate_abstract_class_stub_with_another_member_with_attribute.{tfm}.expected")

testCaseAsync "can generate abstract class stub without trailing nl" <|
CodeFix.check server
Expand All @@ -96,7 +104,7 @@ let tests state =
()"""
(Diagnostics.expectCode "365")
selectCodeFix
(expectFile "can_generate_abstract_class_stub_without_trailing_nl.expected")
(expectFile $"can_generate_abstract_class_stub_without_trailing_nl.{tfm}.expected")

testCaseAsync "inserts override in correct place" <|
CodeFix.check server
Expand All @@ -117,7 +125,7 @@ let tests state =
let a = 0"""
(Diagnostics.expectCode "365")
selectCodeFix
(expectFile "inserts_override_in_correct_place.expected")
(expectFile $"inserts_override_in_correct_place.{tfm}.expected")

testCaseAsync "can generate abstract class stub with existing override" <|
CodeFix.check server
Expand All @@ -140,5 +148,5 @@ let tests state =
()"""
(Diagnostics.expectCode "365")
selectCodeFix
(expectFile "can_generate_abstract_class_stub_with_existing_override.expected")
(expectFile $"can_generate_abstract_class_stub_with_existing_override.{tfm}.expected")
])
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[<AbstractClass>]
type Shape(x0: float, y0: float) =
let mutable x, y = x0, y0

abstract Name : string with get
abstract Area : float with get

member _.Move dx dy =
x <- x + dx
y <- y + dy

type Square(x,y, sideLength) =
inherit Shape(x,y)

override this.Area: float =
failwith "Not Implemented"
override this.Name: string =
failwith "Not Implemented"
()
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[<AbstractClass>]
type Shape(x0: float, y0: float) =
let mutable x, y = x0, y0

abstract Name : string with get
abstract Area : float with get

member _.Move dx dy =
x <- x + dx
y <- y + dy

type Square(x,y, sideLength) =
inherit Shape(x,y)

override this.Area: float =
failwith "Not Implemented"
override this.Name: string =
failwith "Not Implemented"

[<CompiledName("yo")>]
member x.Foo() = 1
()
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[<AbstractClass>]
type Shape(x0: float, y0: float) =
let mutable x, y = x0, y0

abstract Name : string with get
abstract Area : float with get

member _.Move dx dy =
x <- x + dx
y <- y + dy

type Square(x,y, sideLength) =
inherit Shape(x,y)

override this.Area: float =
failwith "Not Implemented"

override this.Name = "Circle"
()
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[<AbstractClass>]
type Shape(x0: float, y0: float) =
let mutable x, y = x0, y0

abstract Name : string with get
abstract Area : float with get

member _.Move dx dy =
x <- x + dx
y <- y + dy

type Square(x,y, sideLength) =
inherit Shape(x,y)

override this.Area: float =
failwith "Not Implemented"
override this.Name: string =
failwith "Not Implemented"
()
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[<AbstractClass>]
type Shape(x0: float, y0: float) =
let mutable x, y = x0, y0

abstract Name : string with get
abstract Area : float with get

member _.Move dx dy =
x <- x + dx
y <- y + dy

type Square(x,y, sideLength) =
inherit Shape(x,y)

override this.Area: float =
failwith "Not Implemented"
override this.Name: string =
failwith "Not Implemented"
let a = 0

0 comments on commit ebb9c5d

Please sign in to comment.