@@ -327,11 +327,74 @@ happen inside a module, which is compiled.
327327If a notebook is performing slower than expected, consider moving
328328the bulk of the execution to inside modules.
329329
330+ ## Erlang integration
331+
332+ Livebook also allows developers to write Erlang code. To do so,
333+ click on the submenu option on the right side of the "Elixir" cell
334+ button and choose Erlang.
335+
336+ Your Erlang code will run alongside your Elixir cells. This means
337+ you can leverage all of dependency management and smart cells features
338+ outlined in the previous sections. In particular, integration between
339+ Erlang and Elixir will happen as follows:
340+
341+ * Variables in Elixir are available in Erlang cells in camel-case
342+ fashion. ` x ` in Elixir becomes ` X ` in Erlang. ` foo_bar ` becomes
343+ ` FooBar ` ;
344+
345+ * Variables in Erlang are available in Elixir cells in underscored
346+ fashion. ` X ` in Erlang becomes ` x ` in Elixir. ` FooBar ` becomes
347+ ` foo_bar ` ;
348+
349+ For example, to print all of the cats defined at the top of the notebook,
350+ but in Erlang:
351+
352+ ``` erlang
353+ [io :format (" ~ts " , [Cat ]) || Cat <- Cats ].
354+ ```
355+
356+ We are just beginning the Erlang integration and contributions to
357+ enrich the support are welcome.
358+
359+ ## Running tests
360+
361+ There are two main ways of running tests inside Livebook.
362+
363+ <!-- livebook:{"break_markdown":true} -->
364+
365+ ### Doctests
366+
367+ Doctests allows developers to provide and test examples directly
368+ from their documentation. Doctests are defined with the ` iex> `
369+ prompts under the ` @moduledoc ` and ` @doc ` attributes of your
370+ modules. Let's see an example:
371+
372+ ``` elixir
373+ defmodule MyModule do
374+ @moduledoc """
375+ This is an example of doctests:
376+
377+ iex> 2 + 2
378+ 5
379+
380+ iex> 6 + 7
381+ 13
382+ """
383+ end
384+ ```
385+
386+ Livebook automatically detect doctests for any defined modules
387+ and automatically executes them when you evaluate the cell.
388+ Doctests which fail are marked in red in the gutter and show
389+ the failure information right below them. Otherwise they are tagged
390+ in green. For more information on doctests and their limitations,
391+ see [ ` ExUnit.Doctest ` ] ( https://hexdocs.pm/ex_unit/ExUnit.DocTest.html ) .
392+
330393<!-- livebook:{"break_markdown":true} -->
331394
332- ### Running tests
395+ ### ExUnit integration
333396
334- It is also possible to run tests directly from your notebooks.
397+ It is also possible to ` ExUnit ` suites directly from your notebooks.
335398The key is to disable ` ExUnit ` 's autorun feature and then explicitly
336399run the test suite after all test cases have been defined:
337400
349412ExUnit .run ()
350413```
351414
352- This helps you follow best practices and ensure the code you write
353- behaves as expected!
415+ This is perfect for testing more complex logic that does not fit under
416+ doctests.
354417
355418## Next steps
356419
0 commit comments