From 16b2c0bea3d8ed4bd11b9c220aa50fd6166a7348 Mon Sep 17 00:00:00 2001 From: Boris Shingarov Date: Mon, 18 Nov 2024 10:00:05 -0500 Subject: [PATCH] Test "void is terminal" at Sprite level --- .../SpriteDataNegTest.class.st | 24 +++++++++++++++++++ .../SpriteDataPosTest.class.st | 23 ++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/SpriteLang-Tests/SpriteDataNegTest.class.st create mode 100644 src/SpriteLang-Tests/SpriteDataPosTest.class.st diff --git a/src/SpriteLang-Tests/SpriteDataNegTest.class.st b/src/SpriteLang-Tests/SpriteDataNegTest.class.st new file mode 100644 index 000000000..9d2a888bc --- /dev/null +++ b/src/SpriteLang-Tests/SpriteDataNegTest.class.st @@ -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) +}; +' +] diff --git a/src/SpriteLang-Tests/SpriteDataPosTest.class.st b/src/SpriteLang-Tests/SpriteDataPosTest.class.st new file mode 100644 index 000000000..b19bcee6a --- /dev/null +++ b/src/SpriteLang-Tests/SpriteDataPosTest.class.st @@ -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) +}; +' +]