noir by example

hello world

the use keyword imports a dependency into scope

use dep::std;

fn main() {
    std::println("πŸ‘‹ hello world");

    let foo = 17;
    std::println(f"some field: {foo}");
}

#[test]
fn test_main() {
    main();
}

now, run the tests with nargo test

[hello_world] Running 1 test functions
[hello_world] Testing test_main...
ok

add a --show-output flag to display the logs

[hello_world] Running 1 test functions
[hello_world] Testing test_main... "πŸ‘‹ hello world"
some field: 0x11
ok

try it out install the noir toolchain if you haven't yet:
        curl -L https://noirup.org/install | bash
        noirup --nightly
        
then checkout and run the example:
        git clone https://github.com/sambarnes/noir-by-example.git
        cd noir-by-example/circuits/examples/hello-world
        nargo test --show-output
        

...

next (assert)