diff --git a/OBO.NET.sln b/OBO.NET.sln index 2db7238..b3501e9 100644 --- a/OBO.NET.sln +++ b/OBO.NET.sln @@ -19,6 +19,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{13CB global.json = global.json LICENSE = LICENSE playground.fsx = playground.fsx + playgroundInput.fsx = playgroundInput.fsx README.md = README.md RELEASE_NOTES.md = RELEASE_NOTES.md EndProjectSection diff --git a/build/TestTasks.fs b/build/TestTasks.fs index 113f964..17604aa 100644 --- a/build/TestTasks.fs +++ b/build/TestTasks.fs @@ -6,6 +6,9 @@ open Fake.DotNet open ProjectInfo open BasicTasks + +let standardParams = Fake.DotNet.MSBuild.CliArguments.Create () + let runTests = BuildTask.create "RunTests" [clean; build] { testProjects |> Seq.iter (fun testProject -> @@ -15,6 +18,10 @@ let runTests = BuildTask.create "RunTests" [clean; build] { Logger = Some "console;verbosity=detailed" Configuration = DotNet.BuildConfiguration.fromString configuration NoBuild = true + MSBuildParams = { + standardParams with + DisableInternalBinLog = true + } } ) testProject ) @@ -22,7 +29,6 @@ let runTests = BuildTask.create "RunTests" [clean; build] { // to do: use this once we have actual tests let runTestsWithCodeCov = BuildTask.create "RunTestsWithCodeCov" [clean; build] { - let standardParams = Fake.DotNet.MSBuild.CliArguments.Create () testProjects |> Seq.iter(fun testProject -> Fake.DotNet.DotNet.test(fun testParams -> @@ -35,6 +41,7 @@ let runTestsWithCodeCov = BuildTask.create "RunTestsWithCodeCov" [clean; build] "AltCoverCobertura","../../codeCov.xml" "AltCoverForce","true" ] + DisableInternalBinLog = true }; Logger = Some "console;verbosity=detailed" } diff --git a/playgroundInput.fsx b/playgroundInput.fsx new file mode 100644 index 0000000..3620807 --- /dev/null +++ b/playgroundInput.fsx @@ -0,0 +1,21 @@ +#I "src/OBO.NET/bin/Debug/netstandard2.0" +#I "src/OBO.NET/bin/Release/netstandard2.0" +#I "src/OBO.NET.CodeGeneration/bin/Debug/netstandard2.0" +#I "src/OBO.NET.CodeGeneration/bin/Release/netstandard2.0" + +#r "OBO.NET.dll" +//#r "OBO.NET.CodeGeneration.dll" + +#r "nuget: ARCtrl.Core" +#r "nuget: FSharpAux" + +open OBO.NET +open OBO.NET.DBXref +open ARCtrl +open FSharpAux +//open OBO.NET.CodeGeneration + + +let res = OboOntology.fromFile true @"C:\Repos\CSBiology\OBO.NET\tests\OBO.NET.Tests\References\WhitespaceAfterTerm.obo" + +let res2 = OboOntology.fromFile true @"C:\Repos\CSBiology\OBO.NET\tests\OBO.NET.Tests\References\WhitespaceAfterTypeDef.obo" \ No newline at end of file diff --git a/tests/OBO.NET.Tests/OBO.NET.Tests.fsproj b/tests/OBO.NET.Tests/OBO.NET.Tests.fsproj index eaa350b..9bf7fea 100644 --- a/tests/OBO.NET.Tests/OBO.NET.Tests.fsproj +++ b/tests/OBO.NET.Tests/OBO.NET.Tests.fsproj @@ -9,6 +9,8 @@ + + diff --git a/tests/OBO.NET.Tests/OboOntology.Tests.fs b/tests/OBO.NET.Tests/OboOntology.Tests.fs index 47671b8..e3911bc 100644 --- a/tests/OBO.NET.Tests/OboOntology.Tests.fs +++ b/tests/OBO.NET.Tests/OboOntology.Tests.fs @@ -54,15 +54,21 @@ module OboOntologyTests = let testFile1Path = Path.Combine(__SOURCE_DIRECTORY__, "References", "CorrectHeaderTags.obo") let testFile2Path = Path.Combine(__SOURCE_DIRECTORY__, "References", "IncorrectHeaderTags.obo") let testFile3Path = Path.Combine(__SOURCE_DIRECTORY__, "References", "DuplicateHeaderTags.obo") + let testFile4Path = Path.Combine(__SOURCE_DIRECTORY__, "References", "WhitespaceAfterTerm.obo") + let testFile5Path = Path.Combine(__SOURCE_DIRECTORY__, "References", "WhitespaceAfterTypeDef.obo") let testFile1 = try OboOntology.fromFile false testFile1Path |> Some with _ -> None let testFile2 = try OboOntology.fromFile false testFile2Path |> Some with _ -> None let testFile3 = try OboOntology.fromFile false testFile3Path |> Some with _ -> None + let testFile4 = try OboOntology.fromFile false testFile4Path |> Some with _ -> None + let testFile5 = try OboOntology.fromFile false testFile5Path |> Some with _ -> None testList "fromFile" [ testCase "can read files" <| fun _ -> Expect.isSome testFile1 $"Could not read testFile1: {testFile1Path}" Expect.isSome testFile2 $"Could not read testFile2: {testFile2Path}" Expect.isSome testFile3 $"Could not read testFile3: {testFile3Path}" + Expect.isSome testFile4 $"Could not read testFile4: {testFile4Path}" + Expect.isSome testFile5 $"Could not read testFile5: {testFile5Path}" testCase "reads correct headers correctly" <| fun _ -> let formatVersionActual = Option.map (fun o -> o.FormatVersion) testFile1 let dataVersionActual = Option.map (fun o -> o.DataVersion) testFile1 |> Option.flatten @@ -129,6 +135,10 @@ module OboOntologyTests = testCase "reads Typedefs correctly" <| fun _ -> let typedefsExpected = List.init 2 (fun i -> OboTypeDef.Create($"Test:000{i + 3}", "", "")) |> Some Expect.equal (Option.map (fun o -> o.TypeDefs) testFile1) typedefsExpected "Terms did not match" + testCase "reads Terms with whitespace correctly" <| fun _ -> + Expect.equal testFile4.Value.Terms.Length 4 "Number of terms did not match" + testCase "reads TypeDefs with whitespace correctly" <| fun _ -> + Expect.equal testFile5.Value.TypeDefs.Length 4 "Number of typedefs did not match" ] let testOntology = OboOntology.Create([testTerm1; testTerm2; testTerm3; testTerm4; testTerm5], [], "", TreatXrefsAsEquivalents = ["check"]) diff --git a/tests/OBO.NET.Tests/References/WhitespaceAfterTerm.obo b/tests/OBO.NET.Tests/References/WhitespaceAfterTerm.obo new file mode 100644 index 0000000..adbf386 --- /dev/null +++ b/tests/OBO.NET.Tests/References/WhitespaceAfterTerm.obo @@ -0,0 +1,43 @@ +format-version: 0.0.1 +data-version: 0.0.1 +ontology: CL +date: 01:01:1970 00:00 +saved-by: Oliver Maus +auto-generated-by: TalkGPT +subsetdef: GO_SLIM "GO Slim" +subsetdef: GO_BASIC "GO Basic" +import: http://purl.obolibrary.org/obo/go.owl +import: http://purl.obolibrary.org/obo/cl.owl +synonymtypedef: UK_SPELLING "British spelling" EXACT +synonymtypedef: US_SPELLING "American spelling" EXACT +idspace: GO urn:lsid:bioontology.org:GO: "gene ontology terms" +idspace: GO urn:lsid:bioontology.org:GO: "gene ontology types" +default-relationship-id-prefix: OBO_REL +id-mapping: part_of OBO_REL:part_of +id-mapping: has_a OBO_REL:has_a +remark: test1 +remark: test2 +treat-xrefs-as-equivalent: CL +treat-xrefs-as-equivalent: GO +treat-xrefs-as-genus-differentia: CL part_of NCBITaxon:7955 +treat-xrefs-as-genus-differentia: CL part_of NCBITaxon:7956 +treat-xrefs-as-relationship: MA homologous_to +treat-xrefs-as-relationship: MA analogous_to +treat-xrefs-as-is_a: CL +treat-xrefs-as-is_a: GO +relax-unique-identifier-assumption-for-namespace: my_combined_ontology +relax-unique-identifier-assumption-for-namespace: my_combined_ontology2 +relax-unique-label-assumption-for-namespace: my_combined_ontology +relax-unique-label-assumption-for-namespace: my_combined_ontology2 + +[Term] +id: Test:0001 + +[Term] +id: Test:0002 + +[Term] +id: Test:0003 + +[Term] +id: Test:0004 \ No newline at end of file diff --git a/tests/OBO.NET.Tests/References/WhitespaceAfterTypeDef.obo b/tests/OBO.NET.Tests/References/WhitespaceAfterTypeDef.obo new file mode 100644 index 0000000..05fa237 --- /dev/null +++ b/tests/OBO.NET.Tests/References/WhitespaceAfterTypeDef.obo @@ -0,0 +1,43 @@ +format-version: 0.0.1 +data-version: 0.0.1 +ontology: CL +date: 01:01:1970 00:00 +saved-by: Oliver Maus +auto-generated-by: TalkGPT +subsetdef: GO_SLIM "GO Slim" +subsetdef: GO_BASIC "GO Basic" +import: http://purl.obolibrary.org/obo/go.owl +import: http://purl.obolibrary.org/obo/cl.owl +synonymtypedef: UK_SPELLING "British spelling" EXACT +synonymtypedef: US_SPELLING "American spelling" EXACT +idspace: GO urn:lsid:bioontology.org:GO: "gene ontology terms" +idspace: GO urn:lsid:bioontology.org:GO: "gene ontology types" +default-relationship-id-prefix: OBO_REL +id-mapping: part_of OBO_REL:part_of +id-mapping: has_a OBO_REL:has_a +remark: test1 +remark: test2 +treat-xrefs-as-equivalent: CL +treat-xrefs-as-equivalent: GO +treat-xrefs-as-genus-differentia: CL part_of NCBITaxon:7955 +treat-xrefs-as-genus-differentia: CL part_of NCBITaxon:7956 +treat-xrefs-as-relationship: MA homologous_to +treat-xrefs-as-relationship: MA analogous_to +treat-xrefs-as-is_a: CL +treat-xrefs-as-is_a: GO +relax-unique-identifier-assumption-for-namespace: my_combined_ontology +relax-unique-identifier-assumption-for-namespace: my_combined_ontology2 +relax-unique-label-assumption-for-namespace: my_combined_ontology +relax-unique-label-assumption-for-namespace: my_combined_ontology2 + +[Typedef] +id: Test:0001 + +[Typedef] +id: Test:0002 + +[Typedef] +id: Test:0003 + +[Typedef] +id: Test:0004 \ No newline at end of file