print.test = print;
var top = 3;
scope{
  assert true /* Basic identifier assignments... */;
  var a = 3, b;
  b = a;
  assert b === a;
  //assert 4 !== c = 4 // must throw for 'c';

  var c;
  c = a = b = a - 2;
  assert 1 === c;
  assert 1 === a;
  assert 1 === b;
  top = 7;
};

assert top === 7;

scope {
  assert true /* Basic property assignments... */;
  var other = print.prototype;
  print.x = 7;
  other.test = 'test';
  assert 7 === print.x;
  print.test[other.test]['y'] = -1;
  assert -1 === print.y;
  print.y = var a = 1;
  assert 1 === print.y;
  assert 1 === a;
  print.y = a = -1;
  assert -1 === print.y;
  assert -1 === a;
};

scope {
  assert true /* Making sure 'this' is respected properly... */;
  var a, other = print.prototype;
  print.x = 0;
  //other.('z') = print.x = a = -1;
  other['z'] = print.x = a = -1;
  assert other.z === -1;
  assert print.x === -1;
  assert a === -1;
  print.x = 1;
  assert other.z === -1;
  assert print.x === 1;
  assert a === -1;
};

0 && scope {
  
  const c= -1;
  c = 1 /* Must fail (assign to const) */;
};

scope {
  var a, other = print.prototype; other.z = print.x = a = -1;
  assert -1 === a;
  assert other.z === a;
  assert print.x === a;
  assert other === print.prototype;
  assert print inherits other;
}

scope {
  var a = 1, b;
  assert (a -= 3) === -2;
  assert 3 === (b = a+=5);
  assert 6 === (a*=1+1);
  assert 1 === (b /= 2);
  assert 3 === (a>>=1);
  assert 2 === (b<<=1);
  a = 2; a*=3+2;
  assert 10===a;
  assert (a/=3*4%5) === 5;
}
