Commit Graph

3160 Commits

Author SHA1 Message Date
rvcas b71315ba2f
chore: trying to fix test 5 2022-12-14 09:45:26 +01:00
Kasey White 6635a918b5
clean up minor warnings 2022-12-14 09:45:26 +01:00
KtorZ b6962ba9d3
Add 'eval' command to evaluate target aiken function
Pretty useful for debbugging. Though, on second-thoughts, this is
  something we may want to review later and maybe have that done by
  default for tests.

  At the moment, we expects tests to unify to `bool`, and treat `false`
  values as failing tests. Yet, on failures, this gives little
  information about what's wrong with the test.

  It'd be nice to either have better way to assert in tests, or, to
  simply accept non-bool tests, and show whatever the test evaluates
  to as a debug output.
2022-12-14 09:45:26 +01:00
KtorZ 95df5f9137
Add new acceptance test scenario (014) 2022-12-14 09:45:26 +01:00
KtorZ bc7c236b3b
Add new acceptance test scenario (013)
```
  ERROR:
  The provided Plutus code called 'error'
  ```
2022-12-14 09:45:25 +01:00
KtorZ 9c902cdf89
Add new acceptance test scenario (012)
```
  Error:
    × Main thread panicked.
    ├─▶ at crates/lang/src/uplc.rs:3413:34
    ╰─▶ internal error: entered unreachable code: Var {
            scope: [
                0,
                1,
                3,
                24,
                25,
                29,
                32,
            ],
            constructor: ValueConstructor {
                public: false,
                variant: LocalVariable {
                    location: 46..62,
                },
                tipo: Fn {
                    args: [
                        Var {
                            tipo: RefCell {
                                value: Link {
                                    tipo: App {
                                        public: true,
                                        module: "",
                                        name: "Int",
                                        args: [],
                                    },
                                },
                            },
                        },
                    ],
                    ret: App {
                        public: true,
                        module: "",
                        name: "Bool",
                        args: [],
                    },
                },
            },
            name: "f",
            variant_name: "",
        }
  ```
2022-12-14 09:45:25 +01:00
KtorZ f53caff538
Add new acceptance test scenario (011)
```
  Error:
    × Main thread panicked.
    ├─▶ at crates/lang/src/uplc.rs:4022:40
    ╰─▶ called `Option::unwrap()` on a `None` value
  ```
2022-12-14 09:45:25 +01:00
rvcas 11c793dd2a
feat(Type): add is_option method 2022-12-14 09:45:25 +01:00
Kasey White 8393d8555c
fill constants to data so now test 006 passes 2022-12-14 09:45:25 +01:00
Kasey White dc5ae296db
implement anonymous functions, more tests pass now 2022-12-14 09:45:25 +01:00
rvcas 299cd1ac24
fix: tuples 2022-12-14 09:45:25 +01:00
KtorZ 37def91fc5
Add new acceptance test scenario (010)
```
  Error:
    × Main thread panicked.
    ├─▶ at crates/lang/src/uplc.rs:688:33
    ╰─▶ called `Option::unwrap()` on a `None` value
    help: set the `RUST_BACKTRACE=1` environment variable to display a backtrace.
  ```
2022-12-14 09:45:24 +01:00
KtorZ 4217fd06b5
Add new acceptance test scenario (009)
Note: the problem is only present when importing a builtin explicitly.
  When using a qualified import, it compiles fine.

  ```
  Error:
    × Main thread panicked.
    ├─▶ at crates/lang/src/uplc.rs:3264:35
    ╰─▶ called `Option::unwrap()` on a `None` value
    help: set the `RUST_BACKTRACE=1` environment variable to display a backtrace.
  ```
2022-12-14 09:45:24 +01:00
KtorZ adf34e9dc6
Add new acceptance test scenario (008)
```
  Error:
    × Main thread panicked.
    ├─▶ at crates/lang/src/uplc.rs:530:41
    ╰─▶ not yet implemented
    help: set the `RUST_BACKTRACE=1` environment variable to display a backtrace.
  ```
2022-12-14 09:45:24 +01:00
KtorZ 022fc36dd2
Add new (failing) acceptance test (007)
```
  Error: aiken::check

    × Checking
    ╰─▶ Not a function
     ╭─[./007/lib/test.ak:4:1]
   4 │     [(a, b), ..rest] -> {
   5 │       let (a_tail, b_tail) = unzip(rest)
     ·                                   ──────
   6 │       ([a, ..a_tail], [b, ..b_tail])
     ╰────
  ```
2022-12-14 09:45:24 +01:00
KtorZ a62fb1905e
rename examples/tests/{a,b,c,d,e,f} into examples/acceptance_tests/00{1,2,3,4,5,6}
Also added a little Makefile to run them all in one go.
2022-12-14 09:45:24 +01:00
KtorZ b294063097
Add another acceptance test (f)
```
  Error:
    × Main thread panicked.
    ├─▶ at crates/lang/src/uplc.rs:4043:46
    ╰─▶ not yet implemented
    help: set the `RUST_BACKTRACE=1` environment variable to display a backtrace.
  ```
2022-12-14 09:45:24 +01:00
KtorZ 603f4a6385
Add another failing example (e)
```
  Error:
    × Main thread panicked.
    ├─▶ at crates/lang/src/uplc.rs:1518:45
    ╰─▶ called `Option::unwrap()` on a `None` value
    help: set the `RUST_BACKTRACE=1` environment variable to display a backtrace.
  ```
2022-12-14 09:45:24 +01:00
KtorZ 572121974e
Update generic syntax in tests. 2022-12-14 09:45:23 +01:00
KtorZ 8f69a4b600
Add another failing test example (d)
```
  Error:
    × Main thread panicked.
    ├─▶ at crates/lang/src/uplc.rs:3264:35
    ╰─▶ called `Option::unwrap()` on a `None` value
    help: set the `RUST_BACKTRACE=1` environment variable to display a backtrace.
  ```
2022-12-14 09:45:23 +01:00
Kasey White d78e2c9c6f
feat: finish up generic match cases 2022-12-14 09:45:23 +01:00
Kasey White e43063d447
overhaul monomorphize to cover all generic cases
test b passes
2022-12-14 09:45:23 +01:00
rvcas 77386893d7
test: actually repeat 2022-12-14 09:45:23 +01:00
Kasey White 15dc202810
Feat: generic function call tests work 2022-12-14 09:45:23 +01:00
Kasey White e4d9ca4586
support generics 2022-12-14 09:45:23 +01:00
rvcas 16fbf5bbcd
feat: fix recursive functions 2022-12-14 09:45:22 +01:00
Kasey White 3d3b3d7e10
checkpoint 2022-12-14 09:45:22 +01:00
KtorZ 04c05f8d63
Add some tests that make the compiler panick. 2022-12-14 09:45:22 +01:00
KtorZ 95986fed83 Fix lexer for signed integers. 2022-12-13 19:52:30 -05:00
KtorZ 18bf89418a Fix codegen for binary operator 'or'
a && b → if a { b } else { false }
  a || b → if a { true } else { b }
2022-12-13 18:52:23 -05:00
KtorZ 431b0cfcf2 Preserve newlines after blocks of comments.
This is an example of output from the formatter now:

  ```
  //// Some module documentation

  // foo
  const a: Int = 42

  // Some comment block
  // For which newlines are respected.
  // Foo

  // Another one

  /// add_one documentation
  pub fn add_one(n: Int) -> Int {
    // n + 1
    n + 1
  }
  ```

  before this commit, comments would all be collapsed into one group
  above the function as:

  ```
  // Some comment block
  // For which newlines are respected.
  // Foo
  // Another one
  /// add_one documentation
  pub fn add_one(n: Int) -> Int {
  ```
2022-12-13 18:52:23 -05:00
KtorZ 22a526bb13 Enforce unique top-level names for tests too.
This prevents the compiler from crashing later on. Test names should be unique and not clash with function names.
2022-12-13 18:52:23 -05:00
rvcas 4dfb454d8a refactor: change match to if matches! 2022-12-13 10:34:34 -05:00
KtorZ 1637a0d30e Add --match-tests to 'check' cmd
For running only tests matching a certain pattern. Useful when doing TDD.
2022-12-13 10:34:34 -05:00
KtorZ 0d891daac8 Rework the language-tour
To be more progressive in introducing concepts. It also now groups similar concepts together so that they are easier to find and connect with one another.

  I've also added few precisions along the way, as well as corrected a few old syntax (e.g. 'case', generics, tuples..).

  Note that some examples provided in the language tour currently fail to parse / type-check properly.a
2022-12-13 10:29:38 -05:00
KtorZ 308cbb76ff Show resources as links + use permalink + add a few. 2022-12-13 10:29:38 -05:00
KtorZ 6361a1da08 Rename 'comparisons' to 'Ecosystem Overview'
'comparisons' felt a bit out-of-context on the summary/sidebar.
2022-12-13 10:29:38 -05:00
KtorZ 9add261006 Review 'comparisons', add some precisions here and there. 2022-12-13 10:29:38 -05:00
KtorZ 8a4c5a5516 Add some minor precisions in 'getting-started'
And tweaks the link to the editor plugins already -- a bit ahead of time.
2022-12-13 10:29:38 -05:00
rvcas 69db9696d6 feat: prefix tuples with hash again cause ambguity with call 2022-12-13 10:27:17 -05:00
rvcas 6dc4738b66 feat: update formatter for new changes 2022-12-12 19:22:11 -05:00
rvcas a4f6388eca feat: remove the need for # in front of tuples 2022-12-12 19:22:11 -05:00
rvcas dfc57b347a feat: switch generic type args to be delimited by chevrons 2022-12-12 19:22:11 -05:00
Olof Blomqvist 51d1dce180 update link to user manual 2022-12-12 09:15:11 -05:00
rvcas a18aad7daf refactor(project): use new Options instead of a spiderweb of bools 2022-12-10 19:14:58 -05:00
Matthias Benkort 0449c818e5
Merge pull request #160 from txpipe/pairing_testing
Aiken Testing Framework
2022-12-09 16:03:59 +01:00
KtorZ 0eb3cf221b
Trigger and report on more events in the compilation pipeline. 2022-12-09 15:04:02 +01:00
KtorZ 749d8ecb10
Fix formatter to not prefix tests as 'pub' 2022-12-09 14:35:50 +01:00
KtorZ a541018a56
Complete CHANGELOG about new test support. 2022-12-09 14:29:13 +01:00
KtorZ d09d38d65b
Add a flag '--skip-tests' to the 'check' cmd.
So that tests can be skipped, and the old behavior recovered if necessary.

  Tests execution is on by default however.
2022-12-09 14:14:15 +01:00