]> git.draconx.ca Git - dxcommon.git/blobdiff - tests/macros.at
Fix DX_BASEDIR hoisting problems in base.m4.
[dxcommon.git] / tests / macros.at
index 9986d75ffd0274b3ffc73d03d59b380d1c575599..f57ecae23976626ab7e9e8f49effb446dfff2746 100644 (file)
@@ -26,14 +26,12 @@ dnl Verify that the DX_BASEDIR macro expands correctly during argument
 dnl collection.  Crucially, the output must not contain any other text.
 AT_SETUP([DX_BASEDIR during argument collection])
 
-AT_XFAIL_IF([:])
-
 AT_DATA([test.in],
 [[@TEST@
 ]])
 
 TEST_CONFIGURE_AC(
-[[AC@&t@_SUBST([TEST], 'm4@&t@_dquote(DX_BASEDIR)')
+[[AC_SUBST([TEST], 'm4@&t@_dquote(DX_BASEDIR)')
 AC_CONFIG_FILES([test])
 ]])
 TEST_AUTORECONF
@@ -44,3 +42,39 @@ printf '%s\n' "$srcdir" | sed -e 's:/\./:/:g' -e 's:/\.$::g' \
 AT_CHECK([cat test], [0], [expout])
 
 AT_CLEANUP
+
+dnl Verify that DX_BASEDIR is correctly AC_SUBSTed
+AT_SETUP([DX_BASEDIR output substitution])
+
+AT_DATA([test.in],
+[[@DX_BASEDIR@
+]])
+
+TEST_CONFIGURE_AC(
+[[DX_INIT
+AC_CONFIG_FILES([test])
+]])
+TEST_AUTORECONF
+TEST_CONFIGURE
+
+printf '%s\n' "$srcdir" | sed -e 's:/\./:/:g' -e 's:/\.$::g' \
+                              -e 's:\(.\)//*:\1/:g' >expout
+AT_CHECK([cat test], [0], [expout])
+
+AT_CLEANUP
+
+dnl Verify that DX_BASEDIR is set correctly implicitly
+AT_SETUP([DX_BASEDIR implicit definition])
+
+AT_DATA([test.in],
+[[@DX_BASEDIR@
+]])
+
+TEST_CONFIGURE_AC(
+[[DX_EXPORTED_SH
+AC_CONFIG_FILES([test])
+]])
+TEST_AUTORECONF
+TEST_CONFIGURE
+
+AT_CLEANUP