/usr/share/doc/racket/syntax/macro-testing.html is in racket-doc 6.7-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>15 Macro Testing</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">▼</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Syntax:<span class="mywbr"> </span> Meta-<wbr></wbr>Programming Helpers</a></td></tr></table></div><div class="tocviewsublistonly" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="stxparse.html" class="tocviewlink" data-pltdoc="x">Parsing and Specifying Syntax</a></td></tr><tr><td align="right">2 </td><td><a href="syntax-helpers.html" class="tocviewlink" data-pltdoc="x">Syntax Object Helpers</a></td></tr><tr><td align="right">3 </td><td><a href="Datum_Pattern_Matching.html" class="tocviewlink" data-pltdoc="x">Datum Pattern Matching</a></td></tr><tr><td align="right">4 </td><td><a href="module-helpers.html" class="tocviewlink" data-pltdoc="x">Module-<wbr></wbr>Processing Helpers</a></td></tr><tr><td align="right">5 </td><td><a href="transformer-helpers.html" class="tocviewlink" data-pltdoc="x">Macro Transformer Helpers</a></td></tr><tr><td align="right">6 </td><td><a href="reader-helpers.html" class="tocviewlink" data-pltdoc="x">Reader Helpers</a></td></tr><tr><td align="right">7 </td><td><a href="Parsing_for_Bodies.html" class="tocviewlink" data-pltdoc="x">Parsing <span class="RktSym"><span class="RktStxLink">for</span></span> Bodies</a></td></tr><tr><td align="right">8 </td><td><a href="Unsafe_for_Clause_Transforms.html" class="tocviewlink" data-pltdoc="x">Unsafe <span class="RktSym"><span class="RktStxLink">for</span></span> Clause Transforms</a></td></tr><tr><td align="right">9 </td><td><a href="Source_Locations.html" class="tocviewlink" data-pltdoc="x">Source Locations</a></td></tr><tr><td align="right">10 </td><td><a href="Preserving_Source_Locations.html" class="tocviewlink" data-pltdoc="x">Preserving Source Locations</a></td></tr><tr><td align="right">11 </td><td><a href="toplevel.html" class="tocviewlink" data-pltdoc="x">Non-<wbr></wbr>Module Compilation And Expansion</a></td></tr><tr><td align="right">12 </td><td><a href="trusted-xforms.html" class="tocviewlink" data-pltdoc="x">Trusting Standard Recertifying Transformers</a></td></tr><tr><td align="right">13 </td><td><a href="docprovide.html" class="tocviewlink" data-pltdoc="x">Attaching Documentation to Exports</a></td></tr><tr><td align="right">14 </td><td><a href="wrapc.html" class="tocviewlink" data-pltdoc="x">Contracts for Macro Subexpressions</a></td></tr><tr><td align="right">15 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Macro Testing</a></td></tr><tr><td align="right">16 </td><td><a href="intdef.html" class="tocviewlink" data-pltdoc="x">Internal-<wbr></wbr>Definition Context Helpers</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><a href="#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._phase1-eval%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">phase1-<wbr></wbr>eval</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._convert-compile-time-error%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">convert-<wbr></wbr>compile-<wbr></wbr>time-<wbr></wbr>error</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._convert-syntax-error%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">convert-<wbr></wbr>syntax-<wbr></wbr>error</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="versionbox"><span class="version">6.7</span></div><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.7", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.7");">top</a></span><span class="navright"> <a href="wrapc.html" title="backward to "14 Contracts for Macro Subexpressions"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Syntax: Meta-Programming Helpers"" data-pltdoc="x">up</a> <a href="intdef.html" title="forward to "16 Internal-Definition Context Helpers"" data-pltdoc="x">next →</a></span> </div><h3 x-source-module="(lib "syntax/scribblings/syntax.scrbl")" x-source-pkg="racket-doc" x-part-tag=""macro-testing"">15<tt> </tt><a name="(part._macro-testing)"></a><a name="(mod-path._syntax/macro-testing)"></a>Macro Testing</h3><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">syntax/macro-testing</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">base</span></span></td></tr></table></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._syntax/macro-testing..rkt)._phase1-eval))"></a><span title="Provided from: syntax/macro-testing | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._phase1-eval%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">phase1-eval</a></span></span><span class="hspace"> </span><span class="RktVar">ct-expr</span><span class="hspace"> </span><span class="RktVar">maybe-quote</span><span class="hspace"> </span><span class="RktVar">maybe-catch?</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="stt"> </span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="specgrammar"><tr><td align="right" valign="baseline"><span class="RktVar">maybe-quote</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">#:quote</span><span class="hspace"> </span><span class="RktVar">quote-id</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="RktVar">maybe-catch?</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">#:catch?</span><span class="hspace"> </span><span class="RktVar">catch?</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Evaluates <span class="RktVar">ct-expr</span> at compile time and quotes the result using
<span class="RktVar">quote-id</span>, which defaults to <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=quote.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._quote%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">quote</a></span>. Another suitable
argument for <span class="RktVar">quote-id</span> is <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=Syntax_Quoting__quote-syntax.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._quote-syntax%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">quote-syntax</a></span>.</div></p><p>If <span class="RktVar">catch?</span> is <span class="RktVal">#t</span>, then if the evaluation of
<span class="RktVar">ct-expr</span> raises a compile-time exception, it is caught and
converted to a run-time exception.</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">struct</a></span><span class="hspace"> </span><span class="RktSym">point</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktSym">y</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._phase1-eval%29%29" class="RktStxLink" data-pltdoc="x">phase1-eval</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=structinfo.html%23%2528def._%2528%2528lib._racket%252Fstruct-info..rkt%2529._extract-struct-info%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">extract-struct-info</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stxtrans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._syntax-local-value%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">syntax-local-value</a></span><span class="hspace"> </span><span class="RktRdr">#'</span><span class="RktSym">point</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(struct:point point point? (point-y point-x) (#f #f) #t)</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._phase1-eval%29%29" class="RktStxLink" data-pltdoc="x">phase1-eval</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=structinfo.html%23%2528def._%2528%2528lib._racket%252Fstruct-info..rkt%2529._extract-struct-info%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">extract-struct-info</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stxtrans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._syntax-local-value%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">syntax-local-value</a></span><span class="hspace"> </span><span class="RktRdr">#'</span><span class="RktSym">point</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">#:quote</span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=Syntax_Quoting__quote-syntax.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._quote-syntax%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">quote-syntax</a></span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">#<syntax (struct:point point point? (p...></span></p></td></tr></table></blockquote></div></p><p class="SHistory">Added in version 6.3 of package <span class="stt">base</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._syntax/macro-testing..rkt)._convert-compile-time-error))"></a><span title="Provided from: syntax/macro-testing | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._convert-compile-time-error%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">convert-compile-time-error</a></span></span><span class="hspace"> </span><span class="RktVar">expr</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Equivalent to <span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=__expression.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._%7E23%7E25expression%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">#%expression</a></span><span class="stt"> </span><span class="RktVar">expr</span><span class="RktPn">)</span> except if expansion of
<span class="RktVar">expr</span> causes a compile-time exception to be raised; in that
case, the compile-time exception is converted to a run-time exception
raised when the expression is evaluated.</div></p><p>Use <span class="RktSym"><a href="#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._convert-compile-time-error%29%29" class="RktStxLink" data-pltdoc="x">convert-compile-time-error</a></span> to write tests for
compile-time error checking like syntax errors:</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=rackunit&rel=api.html%23%2528def._%2528%2528lib._rackunit%252Fmain..rkt%2529._check-exn%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">check-exn</a></span><span class="hspace"> </span><span class="RktVal">#rx"missing an \"else\" expression"</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._convert-compile-time-error%29%29" class="RktStxLink" data-pltdoc="x">convert-compile-time-error</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._if%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">if</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=rackunit&rel=api.html%23%2528def._%2528%2528lib._rackunit%252Fmain..rkt%2529._check-exn%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">check-exn</a></span><span class="hspace"> </span><span class="RktVal">#rx"missing formals and body"</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._convert-compile-time-error%29%29" class="RktStxLink" data-pltdoc="x">convert-compile-time-error</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="RktErr">--------------------</span></p></td></tr><tr><td><p><span class="RktErr">FAILURE</span></p></td></tr><tr><td><p><span class="RktErr">message: </span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">"Wrong exception raised"</span></p></td></tr><tr><td><p><span class="RktErr">exn-message: "eval:6:0: lambda: bad syntax\n</span><span class="hspace"> </span><span class="RktErr">in: (lambda)"</span></p></td></tr><tr><td><p><span class="RktErr">exn: </span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">#(struct:exn:fail:syntax "eval:6:0: lambda: bad syntax\n</span><span class="hspace"> </span><span class="RktErr">in: (lambda)" #<continuation-mark-set> (#<syntax:6:0 (lambda)>))</span></p></td></tr><tr><td><p><span class="RktErr">name:</span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">check-exn</span></p></td></tr><tr><td><p><span class="RktErr">location:</span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(eval 6 0 6 1)</span></p></td></tr><tr><td><p><span class="RktErr">expression:</span><span class="hspace"> </span><span class="RktErr">(check-exn #rx"missing formals and body" (lambda () (convert-compile-time-error (lambda))))</span></p></td></tr><tr><td><p><span class="RktErr">params:</span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(#rx"missing formals and body" #<procedure:temp10>)</span></p></td></tr><tr><td><p><span class="RktErr"></span></p></td></tr><tr><td><p><span class="RktErr">Check failure</span></p></td></tr><tr><td><p><span class="RktErr">--------------------</span></p></td></tr></table></td></tr></table></blockquote></div></p><p>Without the use of <span class="RktSym"><a href="#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._convert-compile-time-error%29%29" class="RktStxLink" data-pltdoc="x">convert-compile-time-error</a></span>, the checks
above would not be executed because the test program would not compile.</p><p class="SHistory">Added in version 6.3 of package <span class="stt">base</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._syntax/macro-testing..rkt)._convert-syntax-error))"></a><span title="Provided from: syntax/macro-testing | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._convert-syntax-error%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">convert-syntax-error</a></span></span><span class="hspace"> </span><span class="RktVar">expr</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._convert-compile-time-error%29%29" class="RktStxLink" data-pltdoc="x">convert-compile-time-error</a></span>, but only catches compile-time
<span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=exns.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exn%7E3afail%7E3asyntax%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">exn:fail:syntax?</a></span> exceptions and sets
<span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=exns.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._error-print-source-location%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">error-print-source-location</a></span> to <span class="RktVal">#f</span> around the
expansion of <span class="RktVar">expr</span> to make the message easier to match
exactly.</div></p><p><div class="SIntrapara">Example:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=rackunit&rel=api.html%23%2528def._%2528%2528lib._rackunit%252Fmain..rkt%2529._check-exn%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">check-exn</a></span><span class="hspace"> </span><span class="RktVal">#rx"^lambda: bad syntax$"</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._convert-syntax-error%29%29" class="RktStxLink" data-pltdoc="x">convert-syntax-error</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr></table></blockquote></div></p><p class="SHistory">Added in version 6.3 of package <span class="stt">base</span>.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.7", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.7");">top</a></span><span class="navright"> <a href="wrapc.html" title="backward to "14 Contracts for Macro Subexpressions"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Syntax: Meta-Programming Helpers"" data-pltdoc="x">up</a> <a href="intdef.html" title="forward to "16 Internal-Definition Context Helpers"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|