From cd205f2eb9c80487b251cf12ccc8a1e6665fa70e Mon Sep 17 00:00:00 2001 From: Umur Ozkul Date: Tue, 23 Aug 2022 11:48:22 +0200 Subject: [PATCH] test for parseInclude --- .../ReducerProject_includes_test.res | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_includes_test.res diff --git a/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_includes_test.res b/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_includes_test.res new file mode 100644 index 00000000..bce7c84b --- /dev/null +++ b/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_includes_test.res @@ -0,0 +1,33 @@ +@@warning("-44") +module InternalExpressionValue = ReducerInterface_InternalExpressionValue +module Project = ForTS_ReducerProject +module Bindings = Reducer_Bindings + +open Jest +open Expect +open Expect.Operators + +Only.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) + } + }) +})