Changeset 26688 in webkit for trunk/JavaScriptCore/API


Ignore:
Timestamp:
Oct 16, 2007, 4:25:33 PM (18 years ago)
Author:
ggaren
Message:

Reviewed by Darin Adler.


Global replace of assert with ASSERT.

Location:
trunk/JavaScriptCore/API
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSNode.c

    r21131 r26688  
    3030#include "NodeList.h"
    3131#include "UnusedParam.h"
    32 #include <assert.h>
     32#include <wtf/Assertions.h>
    3333
    3434static JSValueRef JSNode_appendChild(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     
    125125    UNUSED_PARAM(propertyName);
    126126    Node* node = JSObjectGetPrivate(thisObject);
    127     assert(node);
     127    ASSERT(node);
    128128    return JSNodeList_new(context, NodeList_new(node));
    129129}
     
    148148{
    149149    Node* node = JSObjectGetPrivate(object);
    150     assert(node);
     150    ASSERT(node);
    151151
    152152    Node_ref(node);
     
    156156{
    157157    Node* node = JSObjectGetPrivate(object);
    158     assert(node);
     158    ASSERT(node);
    159159
    160160    Node_deref(node);
  • trunk/JavaScriptCore/API/JSNodeList.c

    r21131 r26688  
    2828#include "JSNodeList.h"
    2929#include "UnusedParam.h"
    30 #include <assert.h>
     30#include <wtf/Assertions.h>
    3131
    3232static JSValueRef JSNodeList_item(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     
    3434    if (argumentCount > 0) {
    3535        NodeList* nodeList = JSObjectGetPrivate(thisObject);
    36         assert(nodeList);
     36        ASSERT(nodeList);
    3737        Node* node = NodeList_item(nodeList, (unsigned)JSValueToNumber(context, arguments[0], exception));
    3838        if (node)
     
    5353   
    5454    NodeList* nodeList = JSObjectGetPrivate(thisObject);
    55     assert(nodeList);
     55    ASSERT(nodeList);
    5656    return JSValueMakeNumber(context, NodeList_length(nodeList));
    5757}
     
    6565{
    6666    NodeList* nodeList = JSObjectGetPrivate(thisObject);
    67     assert(nodeList);
     67    ASSERT(nodeList);
    6868    double index = JSValueToNumber(context, JSValueMakeString(context, propertyName), exception);
    6969    unsigned uindex = (unsigned)index;
     
    8080{
    8181    NodeList* nodeList = JSObjectGetPrivate(thisObject);
    82     assert(nodeList);
     82    ASSERT(nodeList);
    8383   
    8484    NodeList_ref(nodeList);
     
    8888{
    8989    NodeList* nodeList = JSObjectGetPrivate(thisObject);
    90     assert(nodeList);
     90    ASSERT(nodeList);
    9191
    9292    NodeList_deref(nodeList);
  • trunk/JavaScriptCore/API/minidom.c

    r21342 r26688  
    2626
    2727#include "JSNode.h"
     28#include <wtf/Assertions.h>
    2829#include <wtf/UnusedParam.h>
    2930
     
    103104            buffer_capacity *= 2;
    104105            buffer = (char*)realloc(buffer, buffer_capacity);
    105             assert(buffer);
     106            ASSERT(buffer);
    106107        }
    107108       
    108         assert(buffer_size < buffer_capacity);
     109        ASSERT(buffer_size < buffer_capacity);
    109110    }
    110111    fclose(f);
  • trunk/JavaScriptCore/API/testapi.c

    r25257 r26688  
    2626
    2727#include "JavaScriptCore.h"
    28 #include <assert.h>
    2928#include <math.h>
    30 #include <setjmp.h>
     29#include <wtf/Assertions.h>
    3130#include <wtf/UnusedParam.h>
    3231
     
    320319{
    321320    if (TestInitializeFinalize) {
    322         assert((void*)1 == JSObjectGetPrivate(object));
     321        ASSERT((void*)1 == JSObjectGetPrivate(object));
    323322        JSObjectSetPrivate(object, (void*)2);
    324323    }
     
    329328{
    330329    if (TestInitializeFinalize) {
    331         assert((void*)4 == JSObjectGetPrivate(object));
     330        ASSERT((void*)4 == JSObjectGetPrivate(object));
    332331        Base_didFinalize = true;
    333332    }
     
    396395{
    397396    if (TestInitializeFinalize) {
    398         assert((void*)2 == JSObjectGetPrivate(object));
     397        ASSERT((void*)2 == JSObjectGetPrivate(object));
    399398        JSObjectSetPrivate(object, (void*)3);
    400399    }
     
    404403{
    405404    if (TestInitializeFinalize) {
    406         assert((void*)3 == JSObjectGetPrivate(object));
     405        ASSERT((void*)3 == JSObjectGetPrivate(object));
    407406        JSObjectSetPrivate(object, (void*)4);
    408407    }
     
    458457{
    459458    UNUSED_PARAM(object);
    460     assert(context);
     459    ASSERT(context);
    461460}
    462461
     
    466465{
    467466    JSObjectRef o = JSObjectMake(context, Derived_class(context), (void*)1);
    468     assert(JSObjectGetPrivate(o) == (void*)3);
     467    ASSERT(JSObjectGetPrivate(o) == (void*)3);
    469468}
    470469
     
    482481    TestInitializeFinalize = false;
    483482
    484     assert(Base_didFinalize);
     483    ASSERT(Base_didFinalize);
    485484
    486485    JSClassDefinition globalObjectClassDefinition = kJSClassDefinitionEmpty;
     
    490489   
    491490    JSObjectRef globalObject = JSContextGetGlobalObject(context);
    492     assert(JSValueIsObject(context, globalObject));
     491    ASSERT(JSValueIsObject(context, globalObject));
    493492   
    494493    JSValueRef jsUndefined = JSValueMakeUndefined(context);
     
    536535    JSValueRef jsCFEmptyStringWithCharacters = JSValueMakeString(context, jsCFEmptyIStringWithCharacters);
    537536
    538     assert(JSValueGetType(context, jsUndefined) == kJSTypeUndefined);
    539     assert(JSValueGetType(context, jsNull) == kJSTypeNull);
    540     assert(JSValueGetType(context, jsTrue) == kJSTypeBoolean);
    541     assert(JSValueGetType(context, jsFalse) == kJSTypeBoolean);
    542     assert(JSValueGetType(context, jsZero) == kJSTypeNumber);
    543     assert(JSValueGetType(context, jsOne) == kJSTypeNumber);
    544     assert(JSValueGetType(context, jsOneThird) == kJSTypeNumber);
    545     assert(JSValueGetType(context, jsEmptyString) == kJSTypeString);
    546     assert(JSValueGetType(context, jsOneString) == kJSTypeString);
    547     assert(JSValueGetType(context, jsCFString) == kJSTypeString);
    548     assert(JSValueGetType(context, jsCFStringWithCharacters) == kJSTypeString);
    549     assert(JSValueGetType(context, jsCFEmptyString) == kJSTypeString);
    550     assert(JSValueGetType(context, jsCFEmptyStringWithCharacters) == kJSTypeString);
     537    ASSERT(JSValueGetType(context, jsUndefined) == kJSTypeUndefined);
     538    ASSERT(JSValueGetType(context, jsNull) == kJSTypeNull);
     539    ASSERT(JSValueGetType(context, jsTrue) == kJSTypeBoolean);
     540    ASSERT(JSValueGetType(context, jsFalse) == kJSTypeBoolean);
     541    ASSERT(JSValueGetType(context, jsZero) == kJSTypeNumber);
     542    ASSERT(JSValueGetType(context, jsOne) == kJSTypeNumber);
     543    ASSERT(JSValueGetType(context, jsOneThird) == kJSTypeNumber);
     544    ASSERT(JSValueGetType(context, jsEmptyString) == kJSTypeString);
     545    ASSERT(JSValueGetType(context, jsOneString) == kJSTypeString);
     546    ASSERT(JSValueGetType(context, jsCFString) == kJSTypeString);
     547    ASSERT(JSValueGetType(context, jsCFStringWithCharacters) == kJSTypeString);
     548    ASSERT(JSValueGetType(context, jsCFEmptyString) == kJSTypeString);
     549    ASSERT(JSValueGetType(context, jsCFEmptyStringWithCharacters) == kJSTypeString);
    551550
    552551    JSObjectRef myObject = JSObjectMake(context, MyObject_class(context), NULL);
     
    559558    // Conversions that throw exceptions
    560559    exception = NULL;
    561     assert(NULL == JSValueToObject(context, jsNull, &exception));
    562     assert(exception);
     560    ASSERT(NULL == JSValueToObject(context, jsNull, &exception));
     561    ASSERT(exception);
    563562   
    564563    exception = NULL;
     
    566565    // causing a build break with -Wshorten-64-to-32 enabled.  The issue is known by the appropriate team.
    567566    // After that's resolved, we can remove these casts
    568     assert(isnan((float)JSValueToNumber(context, jsObjectNoProto, &exception)));
    569     assert(exception);
    570 
    571     exception = NULL;
    572     assert(!JSValueToStringCopy(context, jsObjectNoProto, &exception));
    573     assert(exception);
    574    
    575     assert(JSValueToBoolean(context, myObject));
    576    
    577     exception = NULL;
    578     assert(!JSValueIsEqual(context, jsObjectNoProto, JSValueMakeNumber(context, 1), &exception));
    579     assert(exception);
     567    ASSERT(isnan((float)JSValueToNumber(context, jsObjectNoProto, &exception)));
     568    ASSERT(exception);
     569
     570    exception = NULL;
     571    ASSERT(!JSValueToStringCopy(context, jsObjectNoProto, &exception));
     572    ASSERT(exception);
     573   
     574    ASSERT(JSValueToBoolean(context, myObject));
     575   
     576    exception = NULL;
     577    ASSERT(!JSValueIsEqual(context, jsObjectNoProto, JSValueMakeNumber(context, 1), &exception));
     578    ASSERT(exception);
    580579   
    581580    exception = NULL;
    582581    JSObjectGetPropertyAtIndex(context, myObject, 0, &exception);
    583     assert(1 == JSValueToNumber(context, exception, NULL));
     582    ASSERT(1 == JSValueToNumber(context, exception, NULL));
    584583
    585584    assertEqualsAsBoolean(jsUndefined, false);
     
    610609    assertEqualsAsNumber(jsCFEmptyString, 0);
    611610    assertEqualsAsNumber(jsCFEmptyStringWithCharacters, 0);
    612     assert(sizeof(JSChar) == sizeof(UniChar));
     611    ASSERT(sizeof(JSChar) == sizeof(UniChar));
    613612   
    614613    assertEqualsAsCharactersPtr(jsUndefined, "undefined");
     
    640639    assertEqualsAsUTF8String(jsCFEmptyStringWithCharacters, "");
    641640   
    642     assert(JSValueIsStrictEqual(context, jsTrue, jsTrue));
    643     assert(!JSValueIsStrictEqual(context, jsOne, jsOneString));
    644 
    645     assert(JSValueIsEqual(context, jsOne, jsOneString, NULL));
    646     assert(!JSValueIsEqual(context, jsTrue, jsFalse, NULL));
     641    ASSERT(JSValueIsStrictEqual(context, jsTrue, jsTrue));
     642    ASSERT(!JSValueIsStrictEqual(context, jsOne, jsOneString));
     643
     644    ASSERT(JSValueIsEqual(context, jsOne, jsOneString, NULL));
     645    ASSERT(!JSValueIsEqual(context, jsTrue, jsFalse, NULL));
    647646   
    648647    CFStringRef cfJSString = JSStringCopyCFString(kCFAllocatorDefault, jsCFIString);
    649648    CFStringRef cfJSEmptyString = JSStringCopyCFString(kCFAllocatorDefault, jsCFEmptyIString);
    650     assert(CFEqual(cfJSString, cfString));
    651     assert(CFEqual(cfJSEmptyString, cfEmptyString));
     649    ASSERT(CFEqual(cfJSString, cfString));
     650    ASSERT(CFEqual(cfJSEmptyString, cfEmptyString));
    652651    CFRelease(cfJSString);
    653652    CFRelease(cfJSEmptyString);
     
    659658    JSValueProtect(context, jsGlobalValue);
    660659    JSGarbageCollect(context);
    661     assert(JSValueIsObject(context, jsGlobalValue));
     660    ASSERT(JSValueIsObject(context, jsGlobalValue));
    662661    JSValueUnprotect(context, jsGlobalValue);
    663662
    664663    JSStringRef goodSyntax = JSStringCreateWithUTF8CString("x = 1;");
    665664    JSStringRef badSyntax = JSStringCreateWithUTF8CString("x := 1;");
    666     assert(JSCheckScriptSyntax(context, goodSyntax, NULL, 0, NULL));
    667     assert(!JSCheckScriptSyntax(context, badSyntax, NULL, 0, NULL));
     665    ASSERT(JSCheckScriptSyntax(context, goodSyntax, NULL, 0, NULL));
     666    ASSERT(!JSCheckScriptSyntax(context, badSyntax, NULL, 0, NULL));
    668667
    669668    JSValueRef result;
     
    673672
    674673    result = JSEvaluateScript(context, goodSyntax, NULL, NULL, 1, NULL);
    675     assert(result);
    676     assert(JSValueIsEqual(context, result, jsOne, NULL));
     674    ASSERT(result);
     675    ASSERT(JSValueIsEqual(context, result, jsOne, NULL));
    677676
    678677    exception = NULL;
    679678    result = JSEvaluateScript(context, badSyntax, NULL, NULL, 1, &exception);
    680     assert(!result);
    681     assert(JSValueIsObject(context, exception));
     679    ASSERT(!result);
     680    ASSERT(JSValueIsObject(context, exception));
    682681   
    683682    JSStringRef array = JSStringCreateWithUTF8CString("Array");
     
    685684    JSStringRelease(array);
    686685    result = JSObjectCallAsConstructor(context, arrayConstructor, 0, NULL, NULL);
    687     assert(result);
    688     assert(JSValueIsObject(context, result));
    689     assert(JSValueIsInstanceOfConstructor(context, result, arrayConstructor, NULL));
    690     assert(!JSValueIsInstanceOfConstructor(context, JSValueMakeNull(context), arrayConstructor, NULL));
     686    ASSERT(result);
     687    ASSERT(JSValueIsObject(context, result));
     688    ASSERT(JSValueIsInstanceOfConstructor(context, result, arrayConstructor, NULL));
     689    ASSERT(!JSValueIsInstanceOfConstructor(context, JSValueMakeNull(context), arrayConstructor, NULL));
    691690
    692691    o = JSValueToObject(context, result, NULL);
    693692    exception = NULL;
    694     assert(JSValueIsUndefined(context, JSObjectGetPropertyAtIndex(context, o, 0, &exception)));
    695     assert(!exception);
     693    ASSERT(JSValueIsUndefined(context, JSObjectGetPropertyAtIndex(context, o, 0, &exception)));
     694    ASSERT(!exception);
    696695   
    697696    JSObjectSetPropertyAtIndex(context, o, 0, JSValueMakeNumber(context, 1), &exception);
    698     assert(!exception);
    699    
    700     exception = NULL;
    701     assert(1 == JSValueToNumber(context, JSObjectGetPropertyAtIndex(context, o, 0, &exception), &exception));
    702     assert(!exception);
     697    ASSERT(!exception);
     698   
     699    exception = NULL;
     700    ASSERT(1 == JSValueToNumber(context, JSObjectGetPropertyAtIndex(context, o, 0, &exception), &exception));
     701    ASSERT(!exception);
    703702
    704703    JSStringRef functionBody;
     
    708707    functionBody = JSStringCreateWithUTF8CString("rreturn Array;");
    709708    JSStringRef line = JSStringCreateWithUTF8CString("line");
    710     assert(!JSObjectMakeFunction(context, NULL, 0, NULL, functionBody, NULL, 1, &exception));
    711     assert(JSValueIsObject(context, exception));
     709    ASSERT(!JSObjectMakeFunction(context, NULL, 0, NULL, functionBody, NULL, 1, &exception));
     710    ASSERT(JSValueIsObject(context, exception));
    712711    v = JSObjectGetProperty(context, JSValueToObject(context, exception, NULL), line, NULL);
    713712    assertEqualsAsNumber(v, 2); // FIXME: Lexer::setCode bumps startingLineNumber by 1 -- we need to change internal callers so that it doesn't have to (saying '0' to mean '1' in the API would be really confusing -- it's really confusing internally, in fact)
     
    719718    function = JSObjectMakeFunction(context, NULL, 0, NULL, functionBody, NULL, 1, &exception);
    720719    JSStringRelease(functionBody);
    721     assert(!exception);
    722     assert(JSObjectIsFunction(context, function));
     720    ASSERT(!exception);
     721    ASSERT(JSObjectIsFunction(context, function));
    723722    v = JSObjectCallAsFunction(context, function, NULL, 0, NULL, NULL);
    724     assert(v);
    725     assert(JSValueIsEqual(context, v, arrayConstructor, NULL));
     723    ASSERT(v);
     724    ASSERT(JSValueIsEqual(context, v, arrayConstructor, NULL));
    726725   
    727726    exception = NULL;
    728727    function = JSObjectMakeFunction(context, NULL, 0, NULL, jsEmptyIString, NULL, 0, &exception);
    729     assert(!exception);
     728    ASSERT(!exception);
    730729    v = JSObjectCallAsFunction(context, function, NULL, 0, NULL, &exception);
    731     assert(v && !exception);
    732     assert(JSValueIsUndefined(context, v));
     730    ASSERT(v && !exception);
     731    ASSERT(JSValueIsUndefined(context, v));
    733732   
    734733    exception = NULL;
     
    738737    functionBody = JSStringCreateWithUTF8CString("return foo;");
    739738    function = JSObjectMakeFunction(context, foo, 1, argumentNames, functionBody, NULL, 1, &exception);
    740     assert(function && !exception);
     739    ASSERT(function && !exception);
    741740    JSValueRef arguments[] = { JSValueMakeNumber(context, 2) };
    742741    v = JSObjectCallAsFunction(context, function, NULL, 1, arguments, &exception);
     
    753752    JSStringRelease(print);
    754753   
    755     assert(!JSObjectSetPrivate(printFunction, (void*)1));
    756     assert(!JSObjectGetPrivate(printFunction));
     754    ASSERT(!JSObjectSetPrivate(printFunction, (void*)1));
     755    ASSERT(!JSObjectGetPrivate(printFunction));
    757756
    758757    JSStringRef myConstructorIString = JSStringCreateWithUTF8CString("MyConstructor");
     
    761760    JSStringRelease(myConstructorIString);
    762761   
    763     assert(!JSObjectSetPrivate(myConstructor, (void*)1));
    764     assert(!JSObjectGetPrivate(myConstructor));
     762    ASSERT(!JSObjectSetPrivate(myConstructor, (void*)1));
     763    ASSERT(!JSObjectGetPrivate(myConstructor));
    765764   
    766765    string = JSStringCreateWithUTF8CString("Derived");
     
    778777        JSPropertyNameArrayGetNameAtIndex(nameArray, count);
    779778    JSPropertyNameArrayRelease(nameArray);
    780     assert(count == 1); // jsCFString should not be enumerated
     779    ASSERT(count == 1); // jsCFString should not be enumerated
    781780
    782781    JSClassDefinition nullDefinition = kJSClassDefinitionEmpty;
     
    793792    JSStringRelease(functionBody);
    794793    v = JSObjectCallAsFunction(context, function, NULL, 0, NULL, NULL);
    795     assert(JSValueIsEqual(context, v, globalObject, NULL));
     794    ASSERT(JSValueIsEqual(context, v, globalObject, NULL));
    796795    v = JSObjectCallAsFunction(context, function, o, 0, NULL, NULL);
    797     assert(JSValueIsEqual(context, v, o, NULL));
     796    ASSERT(JSValueIsEqual(context, v, o, NULL));
    798797   
    799798    char* scriptUTF8 = createStringWithContentsOfFile("testapi.js");
     
    849848            buffer_capacity *= 2;
    850849            buffer = (char*)realloc(buffer, buffer_capacity);
    851             assert(buffer);
     850            ASSERT(buffer);
    852851        }
    853852       
    854         assert(buffer_size < buffer_capacity);
     853        ASSERT(buffer_size < buffer_capacity);
    855854    }
    856855    fclose(f);
Note: See TracChangeset for help on using the changeset viewer.