Skip to content

Commit e56cf1e

Browse files
committed
txs auto checkin
1 parent d3534b8 commit e56cf1e

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

rust.tex

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1823,10 +1823,34 @@ \section{Writing Automated Tests}
18231823
\frametitle{Adding Custom Failure Messages}
18241824
You can also add a custom message to be printed with the failure message as optional arguments to the \mintinline{rust}|assert!|, \mintinline{rust}|assert_eq!|, and \mintinline{rust}|assert_ne!| macros. Any arguments specified after the required arguments are passed along to the \mintinline{rust}|format!| macro
18251825

1826-
\inputminted{rust}{./code/test5.rs}
1826+
\inputminted[fontsize=\scriptsize]{rust}{./code/test5.rs}
18271827
\end{frame}
18281828

18291829

1830+
1831+
\begin{frame}[fragile]
1832+
\frametitle{Checking for Panics with \mintinline{rust}|should_panic|}
1833+
1834+
\inputminted[fontsize=\scriptsize]{rust}{./code/test6.rs}
1835+
\end{frame}
1836+
1837+
1838+
1839+
\begin{frame}[fragile]
1840+
\frametitle{Using \mintinline{rust}|Result<T, E>| in Tests}
1841+
1842+
\inputminted{rust}{./code/test7.rs}
1843+
1844+
Writing tests so they return a \mintinline{rust}|Result<T, E>| enables you to use the question mark operator in the body of tests, which can be a convenient way to write tests that should fail if any operation within them returns an Err variant.
1845+
1846+
\end{frame}
1847+
1848+
1849+
\begin{frame}[fragile]
1850+
\frametitle{Controlling How Tests Are Run}
1851+
1852+
\end{frame}\
1853+
18301854
\section{An I/O Project: Building a Command Line Program}
18311855
\section{Functional Language Features: Iterators and Closures}
18321856
\section{More About Cargo and Crates.io}

0 commit comments

Comments
 (0)