Browse Source

Test unknown pragma won't break compilation.

Herby Vojčík 6 years ago
parent
commit
adf35fa7bb
2 changed files with 33 additions and 0 deletions
  1. 28 0
      src/Compiler-Tests.js
  2. 5 0
      src/Compiler-Tests.st

+ 28 - 0
src/Compiler-Tests.js

@@ -1487,6 +1487,34 @@ messageSends: ["should:return:"]
 }),
 $globals.CodeGeneratorTest);
 
+$core.addMethod(
+$core.method({
+selector: "testUnknownPragma",
+protocol: "tests",
+fn: function (){
+var self=this,$self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+$self._should_return_("foo < fooBar: 'return 2+3' > | x | ^ x := 6",(6));
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.sendIdx["should:return:"]=1;
+//>>excludeEnd("ctx");
+$self._should_return_("foo | x | < fooBar: 'return 2+3' > ^ x := 6",(6));
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"testUnknownPragma",{},$globals.CodeGeneratorTest)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "testUnknownPragma\x0a\x09self should: 'foo < fooBar: ''return 2+3'' > | x | ^ x := 6' return: 6.\x0a\x09self should: 'foo | x | < fooBar: ''return 2+3'' > ^ x := 6' return: 6",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["should:return:"]
+}),
+$globals.CodeGeneratorTest);
+
 $core.addMethod(
 $core.method({
 selector: "testifFalse",

+ 5 - 0
src/Compiler-Tests.st

@@ -396,6 +396,11 @@ testThisContext
 	self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true
 !
 
+testUnknownPragma
+	self should: 'foo < fooBar: ''return 2+3'' > | x | ^ x := 6' return: 6.
+	self should: 'foo | x | < fooBar: ''return 2+3'' > ^ x := 6' return: 6
+!
+
 testifFalse
 	self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.
 	self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.