2022-09-11 15:22:07 +00:00
|
|
|
// @@warning("-44")
|
|
|
|
// module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
|
|
|
// module Project = ForTS_ReducerProject
|
|
|
|
// module Bindings = Reducer_Bindings
|
2022-08-23 09:48:22 +00:00
|
|
|
|
2022-09-11 15:22:07 +00:00
|
|
|
// open Jest
|
|
|
|
// open Expect
|
|
|
|
// open Expect.Operators
|
2022-08-23 09:48:22 +00:00
|
|
|
|
2022-09-11 15:22:07 +00:00
|
|
|
// describe("Parse includes", () => {
|
|
|
|
// let project = Project.createProject()
|
|
|
|
// Project.setSource(
|
|
|
|
// project,
|
|
|
|
// "main",
|
|
|
|
// `
|
|
|
|
// #include 'common'
|
|
|
|
// x=1`,
|
|
|
|
// )
|
|
|
|
// Project.parseIncludes(project, "main")
|
|
|
|
// test("dependencies", () => {
|
|
|
|
// expect(Project.getDependencies(project, "main")) == ["common"]
|
|
|
|
// })
|
|
|
|
// test("dependents", () => {
|
|
|
|
// expect(Project.getDependents(project, "main")) == []
|
|
|
|
// })
|
|
|
|
// test("getIncludes", () => {
|
|
|
|
// let mainIncludes = Project.getIncludes(project, "main")
|
|
|
|
// switch mainIncludes {
|
|
|
|
// | Ok(includes) => expect(includes) == ["common"]
|
|
|
|
// | Error(error) => fail(error->Reducer_ErrorValue.errorToString)
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// let internalProject = project->Project.T.Private.castToInternalProject
|
|
|
|
// test("past chain", () => {
|
|
|
|
// expect(Project.Private.getPastChain(internalProject, "main")) == ["common"]
|
|
|
|
// })
|
|
|
|
// test("import as variables", () => {
|
|
|
|
// expect(Project.Private.getIncludesAsVariables(internalProject, "main")) == []
|
|
|
|
// })
|
|
|
|
// })
|
2022-08-31 21:54:54 +00:00
|
|
|
|
2022-09-11 15:22:07 +00:00
|
|
|
// describe("Parse includes", () => {
|
|
|
|
// let project = Project.createProject()
|
|
|
|
// Project.setSource(
|
|
|
|
// project,
|
|
|
|
// "main",
|
|
|
|
// `
|
|
|
|
// #include 'common'
|
|
|
|
// #include 'myModule' as myVariable
|
|
|
|
// x=1`,
|
|
|
|
// )
|
|
|
|
// Project.parseIncludes(project, "main")
|
2022-08-31 21:54:54 +00:00
|
|
|
|
2022-09-11 15:22:07 +00:00
|
|
|
// test("dependencies", () => {
|
|
|
|
// expect(Project.getDependencies(project, "main")) == ["common", "myModule"]
|
|
|
|
// })
|
2022-08-31 21:54:54 +00:00
|
|
|
|
2022-09-11 15:22:07 +00:00
|
|
|
// test("dependents", () => {
|
|
|
|
// expect(Project.getDependents(project, "main")) == []
|
|
|
|
// })
|
2022-08-31 21:54:54 +00:00
|
|
|
|
2022-09-11 15:22:07 +00:00
|
|
|
// test("getIncludes", () => {
|
|
|
|
// let mainIncludes = Project.getIncludes(project, "main")
|
|
|
|
// switch mainIncludes {
|
|
|
|
// | Ok(includes) => expect(includes) == ["common", "myModule"]
|
|
|
|
// | Error(error) => fail(error->Reducer_ErrorValue.errorToString)
|
|
|
|
// }
|
|
|
|
// })
|
2022-08-31 21:54:54 +00:00
|
|
|
|
2022-09-11 15:22:07 +00:00
|
|
|
// let internalProject = project->Project.T.Private.castToInternalProject
|
2022-08-31 21:54:54 +00:00
|
|
|
|
2022-09-11 15:22:07 +00:00
|
|
|
// test("direct past chain", () => {
|
|
|
|
// expect(Project.Private.getPastChain(internalProject, "main")) == ["common"]
|
|
|
|
// })
|
2022-08-31 21:54:54 +00:00
|
|
|
|
2022-09-11 15:22:07 +00:00
|
|
|
// test("direct includes", () => {
|
|
|
|
// expect(Project.Private.getDirectIncludes(internalProject, "main")) == ["common"]
|
|
|
|
// })
|
2022-08-31 21:54:54 +00:00
|
|
|
|
2022-09-11 15:22:07 +00:00
|
|
|
// test("include as variables", () => {
|
|
|
|
// expect(Project.Private.getIncludesAsVariables(internalProject, "main")) == [
|
|
|
|
// ("myVariable", "myModule"),
|
|
|
|
// ]
|
|
|
|
// })
|
|
|
|
// })
|
2022-08-31 21:54:54 +00:00
|
|
|
|
2022-09-11 15:22:07 +00:00
|
|
|
// describe("Parse multiple direct includes", () => {
|
|
|
|
// let project = Project.createProject()
|
|
|
|
// Project.setSource(
|
|
|
|
// project,
|
|
|
|
// "main",
|
|
|
|
// `
|
|
|
|
// #include 'common'
|
|
|
|
// #include 'common2'
|
|
|
|
// #include 'myModule' as myVariable
|
|
|
|
// x=1`,
|
|
|
|
// )
|
|
|
|
// Project.parseIncludes(project, "main")
|
|
|
|
// test("dependencies", () => {
|
|
|
|
// expect(Project.getDependencies(project, "main")) == ["common", "common2", "myModule"]
|
|
|
|
// })
|
|
|
|
// test("dependents", () => {
|
|
|
|
// expect(Project.getDependents(project, "main")) == []
|
|
|
|
// })
|
|
|
|
// test("getIncludes", () => {
|
|
|
|
// let mainIncludes = Project.getIncludes(project, "main")
|
|
|
|
// switch mainIncludes {
|
|
|
|
// | Ok(includes) => expect(includes) == ["common", "common2", "myModule"]
|
|
|
|
// | Error(error) => fail(error->Reducer_ErrorValue.errorToString)
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// let internalProject = project->Project.T.Private.castToInternalProject
|
|
|
|
// test("direct past chain", () => {
|
|
|
|
// expect(Project.getPastChain(project, "main")) == ["common", "common2"]
|
|
|
|
// })
|
|
|
|
// test("include as variables", () => {
|
|
|
|
// expect(Project.Private.getIncludesAsVariables(internalProject, "main")) == [
|
|
|
|
// ("myVariable", "myModule"),
|
|
|
|
// ]
|
|
|
|
// })
|
|
|
|
// })
|