Skip to content

Commit

Permalink
Add IDE unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
latkin committed Mar 17, 2015
1 parent 1dc3e15 commit f5649e7
Showing 1 changed file with 75 additions and 1 deletion.
76 changes: 75 additions & 1 deletion vsintegration/src/unittests/Tests.LanguageService.Script.fs
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,81 @@ type ScriptTests() as this =
let code = ["#light";"#r @\"" + fullyqualifiepathtoddll + "\""]
let (project, _) = createSingleFileFsxFromLines code
AssertNoErrorsOrWarnings(project)


[<Test>]
[<Category("fsx closure")>]
member public this.``Fsx.NoError.HashR.RelativePath1``() =
use _guard = this.UsingNewVS()
let solution = this.CreateSolution()
let project = CreateProject(solution,"testproject")
let file1 = AddFileFromText(project,"lib.fs",
["module Lib"
"let X = 42"
])

let bld = Build(project)

let script1Dir = Path.Combine(ProjectDirectory(project), "ccc")
let script1Path = Path.Combine(script1Dir, "Script1.fsx")
let script2Dir = Path.Combine(ProjectDirectory(project), "aaa\\bbb")
let script2Path = Path.Combine(script2Dir, "Script2.fsx")

Directory.CreateDirectory(script1Dir) |> ignore
Directory.CreateDirectory(script2Dir) |> ignore
File.Move(bld.ExecutableOutput, Path.Combine(ProjectDirectory(project), "aaa\\lib.exe"))

let script1 = File.WriteAllLines(script1Path,
["#load \"../aaa/bbb/Script2.fsx\""
"printfn \"%O\" Lib.X"
])
let script2 = File.WriteAllLines(script2Path,
["#r \"../lib.exe\""
])

let script1 = OpenFile(project, script1Path)
TakeCoffeeBreak(this.VS)

MoveCursorToEndOfMarker(script1,"#load")
let ans = GetSquiggleAtCursor(script1)
AssertNoSquiggle(ans)

[<Test>]
[<Category("fsx closure")>]
member public this.``Fsx.NoError.HashR.RelativePath2``() =
use _guard = this.UsingNewVS()
let solution = this.CreateSolution()
let project = CreateProject(solution,"testproject")
let file1 = AddFileFromText(project,"lib.fs",
["module Lib"
"let X = 42"
])

let bld = Build(project)

let script1Dir = Path.Combine(ProjectDirectory(project), "ccc")
let script1Path = Path.Combine(script1Dir, "Script1.fsx")
let script2Dir = Path.Combine(ProjectDirectory(project), "aaa")
let script2Path = Path.Combine(script2Dir, "Script2.fsx")

Directory.CreateDirectory(script1Dir) |> ignore
Directory.CreateDirectory(script2Dir) |> ignore
File.Move(bld.ExecutableOutput, Path.Combine(ProjectDirectory(project), "aaa\\lib.exe"))

let script1 = File.WriteAllLines(script1Path,
["#load \"../aaa/Script2.fsx\""
"printfn \"%O\" Lib.X"
])
let script2 = File.WriteAllLines(script2Path,
["#r \"lib.exe\""
])

let script1 = OpenFile(project, script1Path)
TakeCoffeeBreak(this.VS)

MoveCursorToEndOfMarker(script1,"#load")
let ans = GetSquiggleAtCursor(script1)
AssertNoSquiggle(ans)

/// FEATURE: #load in an .fsx file will include that file in the 'build' of the .fsx.
[<Test>]
member public this.``Fsx.NoError.HashLoad.Simple``() =
Expand Down

0 comments on commit f5649e7

Please # to comment.