summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/truthiness/if.js
blob: 347f9c838457b1dbed9a137c9c0394396df1b4e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function t1(v)
{
  if (v)
    return 1;
  return 0;
}

assertEq(t1(objectEmulatingUndefined()), 0);
assertEq(t1(objectEmulatingUndefined()), 0);
assertEq(t1(objectEmulatingUndefined()), 0);

function t2(v)
{
  if (v)
    return 1;
  return 0;
}

assertEq(t2(17), 1);
assertEq(t2(0), 0);
assertEq(t2(-0), 0);
assertEq(t2(objectEmulatingUndefined()), 0);
assertEq(t2(objectEmulatingUndefined()), 0);
assertEq(t2(objectEmulatingUndefined()), 0);