<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>tests/README.md - fork/team @ master</title>
<meta name="description" content="tests/README.md in fork/team at master.">
<meta property="og:title" content="tests/README.md - fork/team @ master">
<meta property="og:description" content="tests/README.md in fork/team at master.">
<meta property="og:type" content="website">
<meta property="og:site_name" content="git.julia.blue">
<link rel="stylesheet" href="/css/style.css?v=62">
<script type="module" src="/js/main.js?v=62"></script>
</head>
<body>
<main data-ref="master" data-tip="a5260e76d3aa894c64c56e6ddc8545b9a98043ec">
<noscript>
  <div class="callout">
    <p>
      hey! this is a static git repo viewer. commit diffs, file history,
      older commits and other revisions won't load without javascript.
    </p>
    <p>
      you are still able to view source files on branch/tag tips,
      but the experience is degraded.
    </p>
  </div>
</noscript>
<header class="repo"><div>
<h1>fork/team</h1>
</div>
<pre class="clone">git clone https://git.julia.blue/fork/team</pre>
</header>
<p class="snapshot-commit"><span class="commit-author">Pietro Albini</span><span class="commit-message" data-commit="f45565a4d47f8a80bf8f54fce16ba7e6cc3f839f">Merge pull request #418 from pietroalbini/tests</span><span class="snapshot-sha sha" data-commit="f45565a4d47f8a80bf8f54fce16ba7e6cc3f839f">f45565a</span><time datetime="2020-08-28T16:55:13+02:00" title="2020-08-28 16:55:13 +0200">2020-08-28</time></p>
<header class="topbar"><details class="switcher"><summary>master</summary><div class="menu"><strong>branches</strong><a href="/fork/team/ref/dependabot/cargo/h2-0.3.26/">dependabot/cargo/h2-0.3.26</a><a href="/fork/team/ref/gh-pages/">gh-pages</a><a class="current" href="/fork/team/ref/master/">master</a><a href="/fork/team/ref/remove-fuchsia/">remove-fuchsia</a><a class="all" href="/fork/team/refs">all refs →</a></div></details><nav class="crumbs"><a href="/fork/team/">team</a> / <a href="/fork/team/ref/master/tree/tests/">tests</a> / <span class="cur">README.md</span></nav>
<span class="view-stats"><span>955 B</span><span>28 lines</span></span><span class="actions"><a class="raw" href="/fork/team/raw/ad6c3c2574bdb6b0059775ed760faf00283276bd/tests/README.md">raw</a></span></header>
<div class="markdown-view"><input type="radio" name="markdown-view" id="markdown-rendered" checked><label for="markdown-rendered">rendered</label><input type="radio" name="markdown-view" id="markdown-code"><label for="markdown-code">code</label><section class="readme rendered"><h1>Automated tests</h1>
<p>The tool developed in this repository is the cornerstone of the Rust Team's
access control, and a bug in it could result in unauthorized people gaining
access to protected resources and systems. To avoid that, the repository
employs automated tests to discover regressions quickly.</p>
<p>You can run all the tests with the command:</p>
<pre>cargo test
</pre>
<h2>Static API test</h2>
<p>The Static API test ensures the output of the Static API for a dummy repository
is what we expect. This test uses the snapshot testing technique, and the
expected copy is a build of the Static API stored in the git repository.</p>
<p>To add something to the Static API test make the changes you need to the files
in <code>tests/static-api</code> direcory: its layout is the same as the top-level
contents. Once you made the changes, run <code>cargo test</code> to preview the diff. If
the diff is what you expect, run the following command to mark it as the
expected one:</p>
<pre>tests/bless.sh
</pre>
</section><div class="code-panel"><pre class="code src language-markdown"><span class="code-line"><a class="ln" id="L1" href="#L1">1</a><span class="code-text"><a-p>#</a-p> <a-tt>Automated tests</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L2" href="#L2">2</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L3" href="#L3">3</a><span class="code-text">The tool developed in this repository is the cornerstone of the Rust Team&#39;s</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L4" href="#L4">4</a><span class="code-text">access control, and a bug in it could result in unauthorized people gaining</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L5" href="#L5">5</a><span class="code-text">access to protected resources and systems. To avoid that, the repository</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L6" href="#L6">6</a><span class="code-text">employs automated tests to discover regressions quickly.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L7" href="#L7">7</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L8" href="#L8">8</a><span class="code-text">You can run all the tests with the command:</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L9" href="#L9">9</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L10" href="#L10">10</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L11" href="#L11">11</a><span class="code-text"><a-p>cargo test</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L12" href="#L12">12</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L13" href="#L13">13</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L14" href="#L14">14</a><span class="code-text"><a-p>## </a-p><a-tt>Static API test</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L15" href="#L15">15</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L16" href="#L16">16</a><span class="code-text"><a-p>The Static API test ensures the output of the Static API for a dummy repository</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L17" href="#L17">17</a><span class="code-text"><a-p>is what we expect. This test uses the snapshot testing technique, and the</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L18" href="#L18">18</a><span class="code-text"><a-p>expected copy is a build of the Static API stored in the git repository.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L19" href="#L19">19</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L20" href="#L20">20</a><span class="code-text"><a-p>To add something to the Static API test make the changes you need to the files</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L21" href="#L21">21</a><span class="code-text"><a-p>in `tests/static-api` direcory: its layout is the same as the top-level</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L22" href="#L22">22</a><span class="code-text"><a-p>contents. Once you made the changes, run `cargo test` to preview the diff. If</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L23" href="#L23">23</a><span class="code-text"><a-p>the diff is what you expect, run the following command to mark it as the</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L24" href="#L24">24</a><span class="code-text"><a-p>expected one:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L25" href="#L25">25</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L26" href="#L26">26</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L27" href="#L27">27</a><span class="code-text"><a-p>tests/bless.sh</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L28" href="#L28">28</a><span class="code-text"><a-p>```</a-p></span></span></pre></div></div>
</main>
</body>
</html>
