use codesort::*;
#[test]
fn test_javascript_assigns() {
static INPUT: &str = r#"
miaou(function(notif, chat, gui, horn, locals, md, prefs, watch, ws){
var notifications = [], // array of {r:roomId, rname:roomname, mid:messageid}
notifMessage, // an object created with md.notificationMessage displaying notifications
hasWatchUnseen = false,
nbUnseenMessages = 0,
lastUserAction = 0; // ms
notif.updatePingsList = function(){
if (!vis()) notif.updateTab(!!notifications.length, nbUnseenMessages);
if (!notifications.length) {
if (notifMessage) notifMessage.$md.slideUp($.fn.remove);
notifMessage = null;
watch.setPings([]);
return;
}
if (notifMessage) notifMessage.remove();
var localPings = [], otherRooms = {};
notifications.forEach(function(n){
if (locals.room.id==n.r) {
localPings.push(n);
} else {
otherRooms[n.r] = n.rname;
}
});
notifMessage = md.notificationMessage(function($c){
if (localPings.length) {
$('
').addClass('pingroom').append(
$('
').text(
localPings.length +
(localPings.length>1 ? ' pings' : ' ping') + ' in this room.'
)
).append(
$('