Skip to content

Commit

Permalink
Test "void is terminal" at Sprite level
Browse files Browse the repository at this point in the history
  • Loading branch information
shingarov committed Nov 18, 2024
1 parent fa79ee8 commit 16b2c0b
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/SpriteLang-Tests/SpriteDataNegTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Class {
#name : #SpriteDataNegTest,
#superclass : #SpriteLangNegTest,
#category : #'SpriteLang-Tests-Simple'
}

{ #category : #tests }
SpriteDataNegTest >> test_TwoIsNotTerminal [
self processString: '
type two =
| A
| B
;
⟦val cassert : bool[b|b] => int⟧
let cassert = (b) => { 0 };
⟦val main : two => two => int⟧
let main = (x, y) => {
let ok = x == y;
cassert(ok)
};
'
]
23 changes: 23 additions & 0 deletions src/SpriteLang-Tests/SpriteDataPosTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Class {
#name : #SpriteDataPosTest,
#superclass : #SpriteLangPosTest,
#category : #'SpriteLang-Tests-Simple'
}

{ #category : #tests }
SpriteDataPosTest >> test_VoidIsTerminal [
self processString: '
type void =
| Nil
;
⟦val cassert : bool[b|b] => int⟧
let cassert = (b) => { 0 };
⟦val main : void => void => int⟧
let main = (x, y) => {
let ok = x == y;
cassert(ok)
};
'
]

0 comments on commit 16b2c0b

Please sign in to comment.