Skip to content

Commit 404cce8

Browse files
authored
Move test_TextDecoder from test_browser.py to test_other.py. NFC (#24697)
There is nothing browser-specific about this test.
1 parent 52b97ef commit 404cce8

File tree

2 files changed

+31
-27
lines changed

2 files changed

+31
-27
lines changed

test/test_browser.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4257,33 +4257,6 @@ def test_utf8_textdecoder(self):
42574257
def test_utf16_textdecoder(self):
42584258
self.btest_exit('benchmark/benchmark_utf16.cpp', 0, cflags=['--embed-file', test_file('utf16_corpus.txt') + '@/utf16_corpus.txt', '-sEXPORTED_RUNTIME_METHODS=UTF16ToString,stringToUTF16,lengthBytesUTF16'])
42594259

4260-
@also_with_threads
4261-
@parameterized({
4262-
'': ([],),
4263-
'closure': (['--closure=1'],),
4264-
})
4265-
def test_TextDecoder(self, args):
4266-
self.cflags += args
4267-
4268-
self.btest('browser_test_hello_world.c', '0', cflags=['-sTEXTDECODER=0'])
4269-
just_fallback = os.path.getsize('test.js')
4270-
print('just_fallback:\t%s' % just_fallback)
4271-
4272-
self.btest('browser_test_hello_world.c', '0')
4273-
td_with_fallback = os.path.getsize('test.js')
4274-
print('td_with_fallback:\t%s' % td_with_fallback)
4275-
4276-
self.btest('browser_test_hello_world.c', '0', cflags=['-sTEXTDECODER=2'])
4277-
td_without_fallback = os.path.getsize('test.js')
4278-
print('td_without_fallback:\t%s' % td_without_fallback)
4279-
4280-
# td_with_fallback should always be largest of all three in terms of code side
4281-
self.assertGreater(td_with_fallback, td_without_fallback)
4282-
self.assertGreater(td_with_fallback, just_fallback)
4283-
4284-
# the fallback is also expected to be larger in code size than using td
4285-
self.assertGreater(just_fallback, td_without_fallback)
4286-
42874260
def test_small_js_flags(self):
42884261
self.btest('browser_test_hello_world.c', '0', cflags=['-O3', '--closure=1', '-sINCOMING_MODULE_JS_API=[]', '-sENVIRONMENT=web', '--output-eol=linux'])
42894262
# Check an absolute js code size, with some slack.

test/test_other.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16351,3 +16351,34 @@ def test_install(self):
1635116351
# Some files, such as as maintenance tools should not be part of the
1635216352
# install.
1635316353
self.assertNotExists('newdir/tools/maint/')
16354+
16355+
@requires_node
16356+
@parameterized({
16357+
'': ([],),
16358+
'pthreads': (['-pthread'],),
16359+
})
16360+
@parameterized({
16361+
'': ([],),
16362+
'closure': (['--closure=1'],),
16363+
})
16364+
def test_TextDecoder(self, args1, args2):
16365+
self.cflags += args1 + args2
16366+
16367+
self.do_runf('hello_world.c', cflags=['-sTEXTDECODER=0'])
16368+
just_fallback = os.path.getsize('hello_world.js')
16369+
print('just_fallback:\t%s' % just_fallback)
16370+
16371+
self.do_runf('hello_world.c')
16372+
td_with_fallback = os.path.getsize('hello_world.js')
16373+
print('td_with_fallback:\t%s' % td_with_fallback)
16374+
16375+
self.do_runf('hello_world.c', cflags=['-sTEXTDECODER=2'])
16376+
td_without_fallback = os.path.getsize('hello_world.js')
16377+
print('td_without_fallback:\t%s' % td_without_fallback)
16378+
16379+
# td_with_fallback should always be largest of all three in terms of code side
16380+
self.assertGreater(td_with_fallback, td_without_fallback)
16381+
self.assertGreater(td_with_fallback, just_fallback)
16382+
16383+
# the fallback is also expected to be larger in code size than using td
16384+
self.assertGreater(just_fallback, td_without_fallback)

0 commit comments

Comments
 (0)