diff --git a/run.dylan b/run.dylan index 33b264a..6c7a11a 100644 --- a/run.dylan +++ b/run.dylan @@ -31,6 +31,7 @@ define function test-temp-directory () => (d :: false-or()) full-component-name(*component*)); let test-directory = subdirectory-locator(base, "_test", uniquifier, safe-name); + test-output("test-directory = %s\n", test-directory); fs/ensure-directories-exist(test-directory); test-directory end diff --git a/tests/library.dylan b/tests/library.dylan index 10c1da9..3790b92 100644 --- a/tests/library.dylan +++ b/tests/library.dylan @@ -15,7 +15,7 @@ define library testworks-test-suite import: { format, streams }; use strings; use system, - import: { file-system, locators }; + import: { file-system, locators, operating-system }; use testworks; export testworks-test-suite; @@ -24,14 +24,13 @@ end library testworks-test-suite; define module testworks-test-suite use command-line-parser; use common-dylan; - use file-system, - prefix: "fs/"; + use file-system, prefix: "fs/"; use format; use locators; + use operating-system, prefix: "os/"; use streams; use strings; - use table-extensions, - import: { tabling }; + use table-extensions, import: { tabling }; use testworks; use %testworks; diff --git a/tests/run.dylan b/tests/run.dylan index 02451e2..a43edff 100644 --- a/tests/run.dylan +++ b/tests/run.dylan @@ -14,6 +14,23 @@ define test test-test-temp-directory/slash-replaced? () locator-name(dir)); end; +// https://github.com/dylan-lang/testworks/issues/157 +define test test-test-temp-directory/absolute-path () + let dylan = os/environment-variable("DYLAN"); + block () + // This value must be a relative path. + // This test is obviously not thread safe. + os/environment-variable("DYLAN") := "dylan/root"; + let tmp = test-temp-directory(); + let d1 = subdirectory-locator(tmp, "d1"); + let f1 = merge-locators(as(, "f1"), tmp); + let f2 = write-test-file(f1, content: "x"); + assert-equal(resolve-locator(f1), resolve-locator(f2)); + cleanup + os/environment-variable("DYLAN") := dylan; + end; +end test; + define test test-write-test-file () let x = write-test-file("x"); assert-instance?(, x); diff --git a/tests/suite.dylan b/tests/suite.dylan index 852dfa2..435dba0 100644 --- a/tests/suite.dylan +++ b/tests/suite.dylan @@ -27,6 +27,8 @@ define suite testworks-test-suite () test test-run-tests/suite; test test-run-tests/test; test test-tags-match?; + test test-test-temp-directory/absolute-path; + test test-test-temp-directory/slash-replaced?; test test-test-temp-directory; test test-that-not-implemented-is-not-a-failure; test test-that-not-implemented-plus-passed-is-passed;