summaryrefslogtreecommitdiff
path: root/spec/unit/pops/evaluator/variables_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
2014-08-11(PUP-2972) Remove += and -=Andrew Parker1-105/+0
Previously the future parser supported += and -=. += was very similar to the same operator that is in the current parser, but with a few differences to make it consistent with the rest of the language. The += operator no longer performed string concatenation and instead acted like $a = $a + $b. The -= operator was added to complete the set of operators available. However, many people have been confused by these operators (even as they exist in the current parser): * It looks like mutation, but the language does not have mutation * It looks like += from other languages, but doesn't behave like them * Shadowing a variable is something that needs to be explicit, otherwise it becomes confusing. This removes += and -= from the future parser. They are still parsed, but the validation step will issue errors if they are encountered.
2014-06-30(PUP-480) Change -= eval to assign nil instead of :undef for no resultHenrik Lindberg1-1/+1
2013-12-17(maint) Fix flawed test for future evaluatorHenrik Lindberg1-3/+3
A test expected that $a -= x would return the result of the delete. That is wrong, the expectation is that the RHS should be returned to allow chaining of assignments. The test should have also evaluated $a at the end to get the assigned value.
2013-12-05(#22363) Change evaluator error reporting to use Pops::IssuesHenrik Lindberg1-35/+35
The evaluator made call to a fail function that just printed the message without any details. This changes the behavior to use the Pops::Issues system. Many issues have been added. Some error messages were changed.
2013-12-05(#22363) Add examples for -= and += (parser) and fix issues in evaluatorHenrik Lindberg1-0/+24
This adds more examples for -= and += for the parser and fixes issues in the evaluator when evaluating -=.
2013-12-05(#22363) Add examples for match result variable shadowingHenrik Lindberg1-0/+14
There were examples missing that tests evaluation of match operator. (shadow / no shadow, and if failed match alters match data or not).
2013-12-05(#22363) Add variables tests and fix evaluation implementation.Henrik Lindberg1-18/+18
This adds testing of variables, assignment and += assignment in various forms. The + operator has been broken out to a separate method to be used by both + and +=. Corrects calls in runtime support (3x must have string variables names). Corrects problems in the rspec helper w.r.t top/local scope and making sure there is a topscope (to lookup ::x namespaced variables).
2013-12-05(#22363) Add "future evaluator"Henrik Lindberg1-0/+156
This commit contains the initial work on a new evaluator. It operates on the output of the future parser.