Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Issue 10916050: Extend testing of argument definition test expressions. (Closed)

Created:
8 years, 3 months ago by ahe
Modified:
8 years, 3 months ago
Reviewers:
regis, gbracha, kasperl
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Extend testing of argument definition test expressions. Committed: https://code.google.com/p/dart/source/detail?r=11684

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+23 lines, -10 lines) Patch
M dart/tests/language/argument_definition_test.dart View 4 chunks +22 lines, -8 lines 2 comments Download
M dart/tests/language/language_dart2js.status View 2 chunks +1 line, -2 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
ahe
8 years, 3 months ago (2012-08-31 11:53:19 UTC) #1
gbracha
Dart code lgtm
8 years, 3 months ago (2012-08-31 14:06:21 UTC) #2
regis
LGTM Thanks! https://chromiumcodereview.appspot.com/10916050/diff/1/dart/tests/language/argument_definition_test.dart File dart/tests/language/argument_definition_test.dart (right): https://chromiumcodereview.appspot.com/10916050/diff/1/dart/tests/language/argument_definition_test.dart#newcode71 dart/tests/language/argument_definition_test.dart:71: } Matthias wanted me to add this ...
8 years, 3 months ago (2012-08-31 14:44:50 UTC) #3
ahe
8 years, 3 months ago (2012-08-31 15:08:45 UTC) #4
https://chromiumcodereview.appspot.com/10916050/diff/1/dart/tests/language/ar...
File dart/tests/language/argument_definition_test.dart (right):

https://chromiumcodereview.appspot.com/10916050/diff/1/dart/tests/language/ar...
dart/tests/language/argument_definition_test.dart:71: }
On 2012/08/31 14:44:50, regis wrote:
> Matthias wanted me to add this other test yesterday, but I have not figured
out
> what it does and how to call it :-)
> 
> WTF([a, b, c]) {
>   Expect.true(!?a??b:!?c == ?a?!?c:?b)
> }

So that's the origin. I took it from Gilad's chat status :-)

The problem is that this is not testing exactly what you think. It took me a
while to realize, it groups like this:

(!?a) ? (?b) : (((!?c) == ?a) ? (!?c) : (?b))

So if a is not passed, it tests if b is passed.

If a is passed, then (((!?c) == ?a) ? (!?c) : (?b)) reduces to:

(!?c) ? (!?c) : (?b)

Which is the same as:

(!?c) || (?b)

So if a is passed, then it returns true if c is not passed, or if b is passed.

In summary:

(!?a) ? (?b) : ((!?c) || (?b))

Or:

(?a) ?  ((!?c) || (?b)) : (?b)

Or:

(?b) || ((?a) && (!?c))

Unless I made a mistake above...

Powered by Google App Engine
This is Rietveld 408576698