diff options
| author | Joe Eli McIlvain <joe.eli.mac@gmail.com> | 2022-04-03 12:21:45 -0700 |
|---|---|---|
| committer | Jean Abou-Samra <jean@abou-samra.fr> | 2022-04-04 12:53:27 +0200 |
| commit | 080e7cd9ec4ffa30592ecc721deb321f0a33f9d4 (patch) | |
| tree | 1efb9f2ae17a754e1b076125edc9423bfa95487c | |
| parent | 19d5d4f8d6a924a8b1df97498ede2cfea5cb7c74 (diff) | |
| download | pygments-git-080e7cd9ec4ffa30592ecc721deb321f0a33f9d4.tar.gz | |
Update Savi language example.
The previous example shows the old usage of the testing framework.
Now the example reflects the current usage/API of that framework.
| -rw-r--r-- | tests/examplefiles/savi/example.savi | 14 | ||||
| -rw-r--r-- | tests/examplefiles/savi/example.savi.output | 74 |
2 files changed, 23 insertions, 65 deletions
diff --git a/tests/examplefiles/savi/example.savi b/tests/examplefiles/savi/example.savi index 223fcdd9..a267296d 100644 --- a/tests/examplefiles/savi/example.savi +++ b/tests/examplefiles/savi/example.savi @@ -1,9 +1,7 @@ -:import "spec" - :actor Main :new (env) - Specs.run(env, [ - SpecRun(AdditionSpec).new(env) + Spec.Process.run(env, [ + Spec.Run(AdditionSpec).new(env) ]) :class AdditionSpec @@ -14,7 +12,7 @@ :const two U64'val: 0x02 :it "adds two twos" - @assert = @two + '\x02' == 4 + assert: @two + '\x02' == 4 :: Raise an error if the argument is positive. :fun non add_overflow!(a U64'val, b U64'val): a +! b @@ -23,6 +21,6 @@ integers Array(U64)'val = [99, 100, 101] // Check addition overflow for various pairs of addends. - @assert = try (add_overflow!(U64.max_value, 1), False | True) - @assert = try (add_overflow!(U64.max_value, 0), True | False) - @assert = try (add_overflow!(integers[0]!, 1), True | False) + assert error: add_overflow!(U64.max_value, 1) + assert no_error: add_overflow!(U64.max_value, 0) + assert no_error: add_overflow!(integers[0]!, 1) diff --git a/tests/examplefiles/savi/example.savi.output b/tests/examplefiles/savi/example.savi.output index 195753c7..c029ef0b 100644 --- a/tests/examplefiles/savi/example.savi.output +++ b/tests/examplefiles/savi/example.savi.output @@ -1,12 +1,3 @@ -':import' Name.Tag -' ' Text.Whitespace -'"' Literal.String.Double -'spec' Literal.String.Double -'"' Literal.String.Double -'\n' Text.Whitespace - -'\n' Text.Whitespace - ':actor' Name.Tag ' ' Text.Whitespace 'Main' Name.Class @@ -21,7 +12,9 @@ '\n' Text.Whitespace ' ' Text.Whitespace -'Specs' Name.Class +'Spec' Name.Class +'.' Punctuation +'Process' Name.Function '.' Punctuation 'run' Name.Function '(' Punctuation @@ -32,7 +25,9 @@ '\n' Text.Whitespace ' ' Text.Whitespace -'SpecRun' Name.Class +'Spec' Name.Class +'.' Punctuation +'Run' Name.Function '(' Punctuation 'AdditionSpec' Name.Class ')' Punctuation @@ -96,10 +91,8 @@ '\n' Text.Whitespace ' ' Text.Whitespace -'@' Punctuation -'assert' Name.Function -' ' Text.Whitespace -'=' Operator +'assert' Name +':' Punctuation ' ' Text.Whitespace '@' Punctuation 'two' Name.Function @@ -184,14 +177,11 @@ '\n' Text.Whitespace ' ' Text.Whitespace -'@' Punctuation -'assert' Name.Function -' ' Text.Whitespace -'=' Operator +'assert' Name ' ' Text.Whitespace -'try' Name +'error' Name +':' Punctuation ' ' Text.Whitespace -'(' Punctuation 'add_overflow!' Generic.Deleted '(' Punctuation 'U64' Name.Class @@ -201,25 +191,14 @@ ' ' Text.Whitespace '1' Literal.Number ')' Punctuation -',' Punctuation -' ' Text.Whitespace -'False' Name.Class -' ' Text.Whitespace -'|' Operator -' ' Text.Whitespace -'True' Name.Class -')' Punctuation '\n' Text.Whitespace ' ' Text.Whitespace -'@' Punctuation -'assert' Name.Function +'assert' Name ' ' Text.Whitespace -'=' Operator -' ' Text.Whitespace -'try' Name +'no_error' Name +':' Punctuation ' ' Text.Whitespace -'(' Punctuation 'add_overflow!' Generic.Deleted '(' Punctuation 'U64' Name.Class @@ -229,25 +208,14 @@ ' ' Text.Whitespace '0' Literal.Number ')' Punctuation -',' Punctuation -' ' Text.Whitespace -'True' Name.Class -' ' Text.Whitespace -'|' Operator -' ' Text.Whitespace -'False' Name.Class -')' Punctuation '\n' Text.Whitespace ' ' Text.Whitespace -'@' Punctuation -'assert' Name.Function -' ' Text.Whitespace -'=' Operator +'assert' Name ' ' Text.Whitespace -'try' Name +'no_error' Name +':' Punctuation ' ' Text.Whitespace -'(' Punctuation 'add_overflow!' Generic.Deleted '(' Punctuation 'integers' Name @@ -259,12 +227,4 @@ ' ' Text.Whitespace '1' Literal.Number ')' Punctuation -',' Punctuation -' ' Text.Whitespace -'True' Name.Class -' ' Text.Whitespace -'|' Operator -' ' Text.Whitespace -'False' Name.Class -')' Punctuation '\n' Text.Whitespace |
